#include <bits/stdc++.h>
using namespace std;
long long n, m;
string word, path, iznos[2000][2000];
char unos[2000][2000];
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0;i<n;i++){
cin >> word;
for(int j=0;j<m;j++){
unos[i][j] = word[j];
}
}
path = unos[0][0];
int i=0, j=0;
while (i!=n-1 and j!=m-1){
if (unos[i][j+1] > unos[i+1][j]){
i++;
path = path + unos[i][j];
}
else if (unos[i][j+1] > unos[i+1][j]){
j++;
path = path + unos[i][j];
}
}
while (i!=n-1){
i++;
path = path + unos[i][j];
}
while (j!=m-1){
j++;
path = path + unos[i][j];
}
cout << path;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
78 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Runtime error |
62 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Runtime error |
64 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Runtime error |
63 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
5 |
Runtime error |
60 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
6 |
Runtime error |
63 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
7 |
Runtime error |
70 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
8 |
Runtime error |
73 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
9 |
Runtime error |
61 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Runtime error |
61 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
11 |
Runtime error |
60 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
12 |
Runtime error |
60 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
13 |
Runtime error |
60 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
14 |
Runtime error |
61 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
15 |
Runtime error |
63 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
16 |
Runtime error |
72 ms |
66560 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |