# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1030430 | 2024-07-22T05:03:00 Z | 김은성(#10955) | Designated Cities (JOI19_designated_cities) | C++17 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; char sa[1000009], sb[1000009]; int a[1000009], b[1000009], c[1000009]; int main(){ int n, i, j, res = 14239023; scanf("%d", &n); scanf(" %s", sa); scanf(" %s", sb); for(i=0; i<n; i++){ a[i] = (sa[i] == '1'); b[i] = (sb[i] == '1'); } for(i=0; i<(1<<n); i++){ for(j=0; j<n; j++){ c[j] = (bool)(i & (1<<j)); } int cur = -1, ans = 0; for(j=0; j<n; j++){ if(c[j] == cur) continue; if(a[j] == c[j]) cur = -1; else{ cur = c[j]; ans++; } } for(j=0; j<n; j++){ //printf("%d", c[j]); if(c[j] != b[j] && (j==0 || c[j-1] == b[j-1])) ans++; } //printf(" ans=%d\n", ans); res = min(res, ans); } printf("%d\n", res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |