結果

問題 No.715 集合と二人ゲーム
ユーザー square1001
提出日時 2018-07-14 06:10:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 770 ms
コンパイル使用メモリ 70,088 KB
実行使用メモリ 7,396 KB
最終ジャッジ日時 2024-10-09 05:57:27
合計ジャッジ時間 3,551 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int n, a[500009], g[500009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i - 1];
		g[i] = (i <= 2 ? 1 : (g[i - 2] + g[i - 3] == 1 ? 2 : (g[i - 2] * g[i - 3] == 0 ? 1 : 0)));
	}
	sort(a, a + n);
	int l = 0, s = 0;
	for (int i = 1; i <= n; ++i) {
		if (i == n || a[i] - a[i - 1] >= 2) {
			s ^= g[a[i - 1] - a[l] + 1];
			l = i;
		}
	}
	cout << (s ? "First\n" : "Second\n");
	return 0;
}
0