Submission #699585
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define fi first #define se second int h,w; string s[100]; //ここにいるときに勝てるか bool dp[100][100]; bool rec(int y, int x) { if(dp[y][x]) return true; bool ret=false; //下か右下か右 int dy[3]={1,1,0}, dx[3]={0,1,1}; rep(i,3) { int ny=y+dy[i], nx=x+dx[i]; if(0<=ny&&ny<h&&0<=nx&&nx<w && s[ny][nx]=='.') ret|=!rec(ny,nx); } return dp[y][x]=ret; } int main() { cin >>h >>w; rep(i,h) cin >>s[i]; fill(dp[0],dp[100],false); string ans="Second"; if(rec(0,0)) ans="First"; std::cout << ans << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - マス目と駒 |
User | imulan |
Language | C++11 (GCC 4.9.2) |
Score | 100 |
Code Size | 884 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 1048 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, 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 |
Dataset2 | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 29 ms | 868 KB |
01-02.txt | AC | 27 ms | 1040 KB |
01-03.txt | AC | 24 ms | 952 KB |
01-04.txt | AC | 27 ms | 952 KB |
01-05.txt | AC | 27 ms | 944 KB |
01-06.txt | AC | 26 ms | 952 KB |
01-07.txt | AC | 24 ms | 996 KB |
01-08.txt | AC | 27 ms | 1048 KB |
01-09.txt | AC | 25 ms | 920 KB |
01-10.txt | AC | 25 ms | 952 KB |
01-11.txt | AC | 26 ms | 948 KB |
01-12.txt | AC | 27 ms | 916 KB |
01-13.txt | AC | 27 ms | 1048 KB |
01-14.txt | AC | 27 ms | 952 KB |
01-15.txt | AC | 27 ms | 944 KB |
02-01.txt | AC | 25 ms | 948 KB |
02-02.txt | AC | 27 ms | 944 KB |
02-03.txt | AC | 26 ms | 952 KB |
02-04.txt | AC | 27 ms | 952 KB |
02-05.txt | AC | 27 ms | 1040 KB |
02-06.txt | AC | 28 ms | 948 KB |
02-07.txt | AC | 27 ms | 948 KB |
02-08.txt | AC | 30 ms | 1044 KB |
02-09.txt | AC | 27 ms | 948 KB |
02-10.txt | AC | 28 ms | 1048 KB |
02-11.txt | AC | 29 ms | 984 KB |
02-12.txt | AC | 29 ms | 920 KB |
02-13.txt | AC | 29 ms | 952 KB |
02-14.txt | AC | 29 ms | 1044 KB |
02-15.txt | AC | 27 ms | 1044 KB |
sample-01.txt | AC | 27 ms | 944 KB |
sample-02.txt | AC | 26 ms | 948 KB |
sample-03.txt | AC | 26 ms | 952 KB |