結果
| 問題 |
No.100 直列あみだくじ
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2014-12-12 00:13:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 650 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 75,928 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 20:51:44 |
| 合計ジャッジ時間 | 2,514 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 20 |
ソースコード
#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;
}
koyumeishi