# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
376138 | 2021-03-11T01:40:00 Z | daniel920712 | Lamps (JOI19_lamps) | C++14 | 1000 ms | 81644 KB |
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; char a[1000005]; char b[1000005]; bool have[1000005]={0}; int DP[1000005],N; int F(int here) { int i,tt; if(here==N) return 0; if(have[here]) return DP[here]; have[here]=1; if(a[here]==b[here]) DP[here]=F(here+1); else DP[here]=F(here+1)+1; tt=0; for(i=here;i<N;i++) { if(b[i]=='1'&&(i==here||b[i-1]=='0')) tt++; DP[here]=min(DP[here],F(i+1)+tt+1); } tt=0; for(i=here;i<N;i++) { if(b[i]=='0'&&(i==here||b[i-1]=='1')) tt++; DP[here]=min(DP[here],F(i+1)+tt+1); } for(i=here;i<N;i++) { if(a[i]!=b[i]) DP[here]=min(DP[here],F(i+1)+1); else break; } return DP[here]; } int main() { int M,ans=0,i; scanf("%d",&N); scanf("%s %s",a,b); printf("%d\n",F(0)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 512 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Incorrect | 1 ms | 364 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 512 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Incorrect | 1 ms | 364 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Execution timed out | 1103 ms | 81644 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 512 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Incorrect | 1 ms | 364 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |