# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204056 | 2020-02-24T04:18:51 Z | ics0503 | Lamps (JOI19_lamps) | C++17 | 36 ms | 27860 KB |
#include<stdio.h> char a[1212121], b[1212121]; int D[1212121][6]; int min(int a, int b) { if (a < b)return a; return b; } int main() { int n, i, j; scanf("%d%s%s", &n,a+1,b+1); D[0][0] = D[0][1] = D[0][2] = D[0][3] = D[0][4] = 1e9; for (i = 1; i <= n; i++) { if (b[i] != '0')D[i][0] = 1e9; else D[i][0] = min(min(D[i - 1][0], D[i - 1][1] + 1), D[i - 1][5] + 1); if (b[i] != '1')D[i][1] = 1e9; else D[i][1] = min(min(D[i - 1][1], D[i - 1][0] + 1), D[i - 1][5] + 1); if (b[i] != '0')D[i][2] = 1e9; else D[i][2] = min(min(D[i - 1][2], D[i - 1][3] + 1), D[i - 1][4] + 1); if (b[i] != '1')D[i][3] = 1e9; else D[i][3] = min(min(D[i - 1][3], D[i - 1][2] + 1), D[i - 1][4] + 1); if (a[i] == b[i]) D[i][4] = 1e9; else D[i][4] = min(min(min(min(min(D[i - 1][4], D[i - 1][0] + 1), D[i - 1][1] + 1), D[i - 1][2]), D[i - 1][3]), D[i - 1][5] + 1); if (a[i] != b[i])D[i][5] = 1e9; else D[i][5] = min(min(min(min(min(D[i - 1][0], D[i - 1][1]), D[i - 1][2]), D[i - 1][3]), D[i - 1][4]), D[i - 1][5]); } printf("%d", min(min(min(min(min(D[n][0], D[n][1]), D[n][2]), D[n][3]),D[n][4]),D[n][5])); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 376 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Incorrect | 5 ms | 256 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 376 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Incorrect | 5 ms | 256 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 300 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 35 ms | 27640 KB | Output is correct |
8 | Correct | 34 ms | 27644 KB | Output is correct |
9 | Correct | 35 ms | 27720 KB | Output is correct |
10 | Correct | 34 ms | 27640 KB | Output is correct |
11 | Correct | 36 ms | 27640 KB | Output is correct |
12 | Correct | 34 ms | 27860 KB | Output is correct |
13 | Correct | 34 ms | 27640 KB | Output is correct |
14 | Correct | 34 ms | 27640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 376 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Incorrect | 5 ms | 256 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |