結果
| 問題 | No.715 集合と二人ゲーム |
| コンテスト | |
| ユーザー |
kriii
|
| 提出日時 | 2018-07-21 12:30:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 610 bytes |
| 記録 | |
| コンパイル時間 | 1,397 ms |
| コンパイル使用メモリ | 47,436 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 04:46:58 |
| 合計ジャッジ時間 | 4,475 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 WA * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf ("%d",&N);
| ~~~~~~^~~~~~~~~
main.cpp:25:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | for (int i=0;i<N;i++) scanf ("%d",&V[i]);
| ~~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
int A[170];
A[0] = 0; A[1] = 1; A[2] = 1;
for (int i=3;i<170;i++){
set<int> k;
k.insert(A[i-2]);
k.insert(A[i-3]);
for (int a=0;a<=i-3;a++){
int x = A[a] ^ A[i-3-a];
k.insert(x);
}
for (int j=0;;j++) if (!k.count(j)){
A[i] = j; break;
}
}
int N,V[500500];
scanf ("%d",&N);
for (int i=0;i<N;i++) scanf ("%d",&V[i]);
sort(V,V+N);
int l = 0, x = 0;
for (int i=0;i<N;i++){
if (i && V[i-1] + 1 == V[i]) x ^= A[l++];
else l = 1;
x ^= A[l];
}
puts(x?"First":"Second");
return 0;
}
kriii