| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 166865 | Akashi | Lamps (JOI19_lamps) | C++14 | 132 ms | 27840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n;
char a[1000005];
char b[1000005];
int d[1000005][3][2];
int main()
{
scanf("%d", &n);
scanf("%s", a + 1);
scanf("%s", b + 1);
for(int j = 0; j < 3 ; ++j)
for(int t = 0; t < 2 ; ++t)
d[0][j][t] = INF;
d[0][0][0] = 0;
for(int i = 1; i <= n ; ++i){
for(int j = 0; j < 3 ; ++j)
for(int t = 0; t < 2 ; ++t)
d[i][j][t] = INF;
for(int j = 0; j < 3 ; ++j){
for(int t = 0; t < 2 ; ++t){
int val = 0;
if(j == 0) val = a[i] - '0';
else val = j - 1;
if(t == 1) val = 1 - val;
if(val != b[i] - '0') continue ;
for(int j2 = 0; j2 < 3 ; ++j2)
for(int t2 = 0; t2 < 2 ; ++t2)
d[i][j][t] = min(d[i][j][t], d[i - 1][j2][t2] + ((j != j2) & (j > 0)) + ((t != t2) & (t > 0)));
}
}
}
int Sol = INF;
for(int j = 0; j < 3 ; ++j)
for(int t = 0; t < 2 ; ++t)
Sol = min(Sol, d[n][j][t]);
printf("%d", Sol);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
