結果

問題 No.715 集合と二人ゲーム
ユーザー ats5515ats5515
提出日時 2017-09-12 00:31:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,210 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 98,620 KB
実行使用メモリ 8,160 KB
最終ジャッジ日時 2024-04-28 15:54:57
合計ジャッジ時間 25,875 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 5 ms
6,940 KB
testcase_04 AC 6 ms
6,940 KB
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 9 ms
6,940 KB
testcase_07 AC 9 ms
6,940 KB
testcase_08 AC 10 ms
6,944 KB
testcase_09 AC 12 ms
6,940 KB
testcase_10 AC 12 ms
6,944 KB
testcase_11 AC 14 ms
6,940 KB
testcase_12 AC 14 ms
6,940 KB
testcase_13 AC 16 ms
6,940 KB
testcase_14 AC 18 ms
6,944 KB
testcase_15 AC 19 ms
6,940 KB
testcase_16 AC 23 ms
6,944 KB
testcase_17 AC 19 ms
6,944 KB
testcase_18 AC 23 ms
6,944 KB
testcase_19 AC 25 ms
6,944 KB
testcase_20 AC 27 ms
6,944 KB
testcase_21 AC 29 ms
6,944 KB
testcase_22 AC 29 ms
6,940 KB
testcase_23 AC 29 ms
6,944 KB
testcase_24 AC 32 ms
6,940 KB
testcase_25 AC 33 ms
6,944 KB
testcase_26 AC 33 ms
6,940 KB
testcase_27 AC 36 ms
6,940 KB
testcase_28 AC 40 ms
6,944 KB
testcase_29 AC 41 ms
6,940 KB
testcase_30 AC 310 ms
6,940 KB
testcase_31 AC 277 ms
6,944 KB
testcase_32 AC 193 ms
6,940 KB
testcase_33 AC 416 ms
6,944 KB
testcase_34 AC 332 ms
6,944 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 1 ms
6,944 KB
testcase_42 AC 2 ms
6,944 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 2 ms
6,944 KB
testcase_45 AC 2 ms
6,940 KB
testcase_46 AC 2 ms
6,940 KB
testcase_47 AC 2 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 AC 2 ms
6,940 KB
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int G[100005];
signed main() {

	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int seq = 1;
	int maxseq = 1;

	vector<int> cnt;
	for (int i = 0; i < N - 1; i++) {
		if (a[i] + 1 == a[i + 1]) {
			seq++;
		}
		else {
			cnt.push_back(seq);
			maxseq = max(maxseq, seq);
			seq = 1;
		}
	}
	cnt.push_back(seq);
	maxseq = max(maxseq, seq);
	int Nmax = maxseq;
	G[0] = 0;
	G[1] = 1;
	G[2] = 1;
	int st[11];
	int t = 0;
	for (int i = 3; i <= Nmax; i++) {
		for (int j = 0; j < 11; j++) {
			st[j] = 0;
		}
		st[G[i - 2]] = 1;
		st[G[i - 3]] = 1;
		for (int j = 0; i - 4 - j > j; j++) {
			t = G[i - 4 - j] ^ G[j + 1];
			if (t < 11) {
				st[t] = 1;
			}
		}
		t = 0;
		for (int j = 0; j < 11; j++) {
			if (st[j] == 0) {
				G[i] = j;
				break;
			}
		}
	}
	int Grundy = 0;
	for (int i = 0; i < cnt.size(); i++) {
		Grundy ^= G[cnt[i]];
	}
	if (Grundy > 0) {
		cout << "First" << endl;
	}
	else {
		cout << "Second" << endl;
	}
	return 0;
}
0