Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

借别人的代码来测试一个关于使用cin解除绑定的做法,快1000ms地过了,确实有用,但是真危险。

Posted by shinelin at 2015-01-13 14:24:34 on Problem 2470
/*============================================*/
//        Date:         2015/1/13
//        Problem:      
//        Author:       shinelin
//        Memory:       KB
//        Time:         ms
//        Language:     C++
//        To  Be  a  Better  Acmer.
/*============================================*/
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

#define INF 0x7fffffff
#define LL long long
#define MAXN 1005
#define FI first
#define SE second
//  #define DEBUG
const double pi = acos(-1.0);
const double eps = 1e-11;

int n , num[100005] ;

int main()
{
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
	while(cin >> n && n )
	{
		int i , j ;
		for( i = 1 ; i <= n ; i++ )
		{
			cin >> num[i];
		}
		for( j = 1 ; j <= n ; j++ )
		{
			if( num[num[j]] != j )
			{
				break ;
			}
		}
		if( j == n + 1 )
		{
			cout << "ambiguous" <<'\n';
		}
		else
		{
			cout << "not ambiguous" << '\n';
		}
	}
//    printf("\nTime used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator