Task: | Keskiarvot |
Sender: | Ilmari2000 |
Submission time: | 2018-01-07 20:45:45 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1 | details |
#2 | TIME LIMIT EXCEEDED | -- | 1 | details |
#3 | TIME LIMIT EXCEEDED | -- | 1 | details |
#4 | TIME LIMIT EXCEEDED | -- | 1 | details |
#5 | TIME LIMIT EXCEEDED | -- | 1 | details |
#6 | RUNTIME ERROR | 0.42 s | 2 | details |
#7 | RUNTIME ERROR | 0.43 s | 2 | details |
#8 | RUNTIME ERROR | 0.46 s | 2 | details |
#9 | RUNTIME ERROR | 0.43 s | 2 | details |
#10 | RUNTIME ERROR | 0.41 s | 2 | details |
#11 | TIME LIMIT EXCEEDED | -- | 3 | details |
#12 | TIME LIMIT EXCEEDED | -- | 3 | details |
#13 | TIME LIMIT EXCEEDED | -- | 3 | details |
#14 | TIME LIMIT EXCEEDED | -- | 3 | details |
#15 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <iostream> #include <string> char grid[2500][2500]; using namespace std; string ret; void tree(int x, int y, int n, string h) { if(ret != "" && h > ret) return; if(x == n - 1 && y == n - 1) { if(h < ret || ret == "") ret = h; return; } if(x == n - 1 && y < n - 1) tree(x, y + 1, n, h + grid[x][y + 1]); else if(y == n - 1 && x < n - 1) tree(x + 1, y, n, h + grid[x + 1][y]); else if((int)grid[x + 1][y] < (int)grid[x][y + 1]) tree(x + 1, y, n, h + grid[x + 1][y]); else if((int)grid[x][y + 1] < (int)grid[x + 1][y]) tree(x, y + 1, n, h + grid[x][y + 1]); else if(x < n - 1 && y < n - 1) { tree(x + 1, y, n, h + grid[x + 1][y]); tree(x, y + 1, n, h + grid[x][y + 1]); } } int main() { int n; cin >> n; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { cin >> grid[i][j]; } } tree(0, 0, n, string(1, grid[0][0])); cout << ret << endl; }
Test details
Test 1
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 2
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
(empty) |
Test 3
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1000000 999999 999998 999997 9... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 4
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 4 1 6 9 4 793899 5 5 8 7 5 4 7... |
correct output |
---|
1 2 1 1 2 1 2 3 4 5 6 7 8 9 10... |
user output |
---|
(empty) |
Test 5
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 442147 824215 62008 513740 542... |
correct output |
---|
1 1 2 1 1 3 1 2 6 10 11 12 1 1... |
user output |
---|
(empty) |
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
5000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 7
Group: 2
Verdict: RUNTIME ERROR
input |
---|
5000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
(empty) |
Test 8
Group: 2
Verdict: RUNTIME ERROR
input |
---|
5000 1000000 999999 999998 999997 9... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
5000 7 5 6 1 9 1 1 6 10 8 7 4 7 1 1... |
correct output |
---|
1 2 3 4 1 2 7 1 1 2 3 4 5 6 1 ... |
user output |
---|
(empty) |
Test 10
Group: 2
Verdict: RUNTIME ERROR
input |
---|
5000 236071 202283 94200 149202 642... |
correct output |
---|
1 2 3 4 1 1 2 3 5 1 2 1 9 10 1... |
user output |
---|
(empty) |
Test 11
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
user output |
---|
(empty) |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1000000 999999 999998 999997 9... |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 14
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 4 10 3 2 235575 7 374394 4 4 5... |
correct output |
---|
1 1 2 3 1 2 1 2 3 6 7 8 9 10 1... |
user output |
---|
(empty) |
Test 15
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 243549 902542 256118 941342 41... |
correct output |
---|
1 1 2 1 2 5 6 1 8 9 1 2 12 13 ... |
user output |
---|
(empty) |