# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
570535 | 2022-05-30T11:53:49 Z | timreizin | Lamps (JOI19_lamps) | C++17 | 10 ms | 4388 KB |
#include <iostream> #include <vector> #include <numeric> #include <cmath> #include <set> #include <array> #include <algorithm> using namespace std; using ll = long long; int counter(string a, string b) { int last = b.front(), cnt = 0, res = 0; for (int i = 0; i < a.size(); ++i) { if (b[i] != last) { for (int j = i - cnt; j < i; ++j) { if (a[j] != last) { ++res; break; } } cnt = 0; last = b[i]; } ++cnt; } for (int j = (int)a.size() - cnt; j < a.size(); ++j) { if (a[j] != last) { ++res; break; } } return res; } int main() { cin.tie(0)->sync_with_stdio(0); int n; string a, b; cin >> n >> a >> b; cout << counter(a, b); /*int minRes = 1e9; for (int mask = 0; mask < (1 << n); ++mask) { string na = a; int add = 0; for (int i = 0; i < n; ++i) { if (mask & (1 << i)) { if (a[i] == '0') na[i] = '1'; else na[i] = '0'; } if (i > 0) add += !(mask & (1 << i)) && (mask & (1 << (i - 1))); } minRes = min(minRes, counter(na, b) + add); } cout << minRes;*/ return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 320 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 320 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 6 ms | 4388 KB | Output is correct |
8 | Correct | 10 ms | 4388 KB | Output is correct |
9 | Correct | 7 ms | 4264 KB | Output is correct |
10 | Correct | 8 ms | 4260 KB | Output is correct |
11 | Correct | 8 ms | 4388 KB | Output is correct |
12 | Correct | 6 ms | 4380 KB | Output is correct |
13 | Correct | 9 ms | 4260 KB | Output is correct |
14 | Correct | 7 ms | 4284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 320 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |