結果
| 問題 |
No.100 直列あみだくじ
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-03-16 17:52:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 419 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 01:37:04 |
| 合計ジャッジ時間 | 1,382 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", A+i);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
int N, A[51], count[51];
bool used[51];
int main(){
scanf("%d", &N);
for(int i=1;i<=N;i++){
scanf("%d", A+i);
}
for(int i=1;i<=N;i++){
if(used[i]){continue;}
int t = 1;
for(int j=A[i];j!=i;j=A[j]){used[j] = true; t++;}
count[t]++;
}
for(int i=2;i<=N;i+=2){
if(count[i] & 1){puts("No"); return 0;}
}
puts("Yes");
}
tottoripaper