結果

問題 No.100 直列あみだくじ
ユーザー koyumeishikoyumeishi
提出日時 2014-12-12 00:13:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 75,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 14:13:29
合計ジャッジ時間 2,232 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 WA -
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
4,376 KB
testcase_41 WA -
testcase_42 AC 2 ms
4,380 KB
testcase_43 WA -
testcase_44 AC 2 ms
4,380 KB
testcase_45 WA -
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;


int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
		a[i]--;
	}

	bool valid = true;
	vector<int> s(n);
	vector<bool> used(n, false);
	for(int i=0; i<n; i++){
		bool ok = false;
		for(int j=0; j<n; j++){
			if(i==j || j==a[i]) continue;
			if(used[j]) continue;
			used[j] = true;
			ok = true;
			break;
		}
		if(!ok) valid = false;
	}
	cout << (valid?"Yes":"No") << endl;
	return 0;
}
0