#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define st first
#define nd second
#define MOD 1000000007
typedef pair<ll, ll> pii;
const ll maxn = 1e5 + 5;
vector<ll> ans;
char d[15][maxn];
ll n;
ll dfs(ll x, ll y){
if(x < 0 || x >= 10 || y < 0 || y >= n){
return 0;
}
if(d[x][y] == 'X'){
return 0;
}
if(y == n-1){
return 1;
}
if(dfs(x + 1 >= 9 ? 9 : x + 1, y + 1)){
return 1;
}
if(dfs(x - 1 <= 0 ? 0 : x - 1, y + 1)){
ans.pb(y);
return 1;
}
return 0;
}
int main(){
cin >> n;
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < n; i++)
{
cin >> d[j][i];
}
}
dfs(9, 0);
reverse(ans.begin(), ans.end());
for(auto i : ans){
cout << i << " 1\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
1 ms |
340 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
1 ms |
340 KB |
Moves are not sorted in chronological order. |
4 |
Incorrect |
1 ms |
340 KB |
Moves are not sorted in chronological order. |
5 |
Incorrect |
3 ms |
468 KB |
Moves are not sorted in chronological order. |
6 |
Incorrect |
24 ms |
592 KB |
Moves are not sorted in chronological order. |
7 |
Incorrect |
131 ms |
1256 KB |
Moves are not sorted in chronological order. |
8 |
Incorrect |
409 ms |
2476 KB |
Moves are not sorted in chronological order. |
9 |
Execution timed out |
1090 ms |
2180 KB |
Time limit exceeded |
10 |
Incorrect |
73 ms |
5060 KB |
Moves are not sorted in chronological order. |