Submission #3426555
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>; using LL = long long;
using VI = vector<int>; using VVI = vector<VI>;
using PII = pair<int, int>; using PLL = pair<LL, LL>;
using VL = vector<LL>; using VVL = vector<VL>;
#define ALL(a) begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3")
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DEBUG(x)
#endif
const int INF = 1e9; const LL LINF = 1e16;
const LL MOD = 1000000007; const double PI = acos(-1.0);
/* ----- __MAKE_TIME__ Problem: __PROBLEM__ / Link: __CONTEST_URL__ ----- */
/* ------問題------
-----問題ここまで----- */
/* -----解説等-----
----解説ここまで---- */
int DY[3] = { 1, 1, 0, };
int DX[3] = { 0, 1, 1, };
int memo[110][110];
int H, W;
int f(int y , int x , const VS& vs) {
if (memo[y][x] != -1)return memo[y][x];
set<int>se;
FOR(k, 0, 3) {
int ny = y + DY[k], nx = x + DX[k];
if (0 <= ny && ny < H && 0 <= nx && nx < W) {
if(vs[ny][nx]!='#')
se.insert(f(ny, nx, vs));
}
}
int subgame = 0;
while (se.count(subgame))subgame++;
return memo[y][x] = subgame;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cin >> H >> W;
VS vs(H);
FOR(i, 0, H) {
cin >> vs[i];
}
fill(*memo, *memo + 110 * 110, -1);
int ans = f(0, 0, vs);
DEBUG(debug(ans));
VVI res(H, VI(W, 0));
FOR(i, 0, H) {
FOR(j, 0, W) {
res[i][j] = memo[i][j];
}
}
DEBUG(D(res));
cout << (ans ? "First" : "Second") << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - マス目と駒 |
User |
vjudge2 |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
1841 Byte |
Status |
AC |
Exec Time |
3 ms |
Memory |
384 KB |
Judge Result
Set Name |
Sample |
Dataset1 |
Dataset2 |
Score / Max Score |
0 / 0 |
30 / 30 |
70 / 70 |
Status |
|
|
|
Set Name |
Test Cases |
Sample |
sample-01.txt, sample-02.txt, sample-03.txt |
Dataset1 |
sample-01.txt, sample-02.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, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.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, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.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, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.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 |
01-11.txt |
AC |
1 ms |
256 KB |
01-12.txt |
AC |
1 ms |
256 KB |
01-13.txt |
AC |
1 ms |
256 KB |
01-14.txt |
AC |
1 ms |
256 KB |
01-15.txt |
AC |
1 ms |
256 KB |
02-01.txt |
AC |
3 ms |
384 KB |
02-02.txt |
AC |
1 ms |
256 KB |
02-03.txt |
AC |
2 ms |
384 KB |
02-04.txt |
AC |
1 ms |
256 KB |
02-05.txt |
AC |
1 ms |
384 KB |
02-06.txt |
AC |
2 ms |
384 KB |
02-07.txt |
AC |
2 ms |
384 KB |
02-08.txt |
AC |
2 ms |
384 KB |
02-09.txt |
AC |
2 ms |
384 KB |
02-10.txt |
AC |
2 ms |
384 KB |
02-11.txt |
AC |
2 ms |
384 KB |
02-12.txt |
AC |
1 ms |
384 KB |
02-13.txt |
AC |
1 ms |
384 KB |
02-14.txt |
AC |
1 ms |
384 KB |
02-15.txt |
AC |
1 ms |
384 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 |