Submission #5893706
Source Code Expand
#include <iostream> using namespace std; static const int NMAX = 100000; //Cがラベルの番号、Aが豆の数、gはGrundy数 int N, C[NMAX], A[NMAX], g[NMAX]; int main(){ cin >> N; C[0] = A[0] = g[0] = 0; int result = 0; for(int i = 1; i <= N - 1; i++){ cin >> C[i] >> A[i]; g[i] = 0; //茶碗iにおけるGrundy数を求める while(true){ bool d = true; for(int j = 1; j <= C[i]; j++){ if(g[i] == g[i - j]){ g[i]++; d = false; break; } } if(d == true) break; } //全体のGrundy数を更新する if(A[i]%2==1){ result=result^g[i]; } } if(result > 0) cout << "First" << endl; else cout << "Second" << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - 茶碗と豆 |
User | KKT89 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 791 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | Dataset1 | Dataset2 | Dataset3 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 80 / 80 | 20 / 20 | 0 / 4 | ||||||||||
Status |
|
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
Dataset1 | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
Dataset2 | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt |
Dataset3 | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 03-07.txt, 03-08.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 1 ms | 256 KB |
01-03.txt | AC | 1 ms | 256 KB |
01-04.txt | AC | 1 ms | 256 KB |
01-05.txt | AC | 1 ms | 256 KB |
01-06.txt | AC | 1 ms | 256 KB |
01-07.txt | AC | 1 ms | 256 KB |
01-08.txt | AC | 1 ms | 256 KB |
01-09.txt | AC | 1 ms | 256 KB |
01-10.txt | AC | 1 ms | 256 KB |
02-01.txt | AC | 1 ms | 256 KB |
02-02.txt | AC | 1 ms | 256 KB |
02-03.txt | AC | 1 ms | 256 KB |
02-04.txt | AC | 1 ms | 256 KB |
02-05.txt | AC | 1 ms | 256 KB |
02-06.txt | AC | 1 ms | 256 KB |
02-07.txt | AC | 1 ms | 256 KB |
02-08.txt | AC | 1 ms | 256 KB |
03-01.txt | TLE | 2103 ms | 256 KB |
03-02.txt | TLE | 2103 ms | 256 KB |
03-03.txt | TLE | 2103 ms | 256 KB |
03-04.txt | TLE | 2103 ms | 256 KB |
03-05.txt | TLE | 2103 ms | 256 KB |
03-06.txt | TLE | 2103 ms | 256 KB |
03-07.txt | AC | 38 ms | 1408 KB |
03-08.txt | AC | 37 ms | 1408 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |
sample-03.txt | AC | 1 ms | 256 KB |