# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204070 | 2020-02-24T07:30:06 Z | ics0503 | Lamps (JOI19_lamps) | C++17 | 5 ms | 376 KB |
#include<stdio.h> int D[1212121][3]; char a[1212121], b[1212121]; int min(int a, int b) { if (a < b)return a; return b; } int get(char a, int tp) { if (tp == 0)return '0'; if (tp == 1)return '1'; return a; } int main() { int n; scanf("%d%s%s", &n, a, b); int i, j, k; D[0][0] = D[0][1] = 1e9; D[0][2] = 0; for (i = 1; i <= n; i++) { for (j = 0; j < 3; j++) { D[i][j] = 1e9; for (k = 0; k < 3; k++) { D[i][j] = min(D[i][j], D[i - 1][k] + (j != 2 && j != k) + ((i==1 || get(a[i - 1], k) == b[i - 1]) && get(a[i], j) != b[i])); } } } int ans = 1e9; for (i = 0; i < 3; i++)ans = min(ans, D[n][i]); printf("%d", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |