# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117665 | 2019-06-17T05:15:11 Z | 이온조(#2879) | Ljetopica (COI19_ljetopica) | C++14 | 3 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int D[1009][1009]; char S[1009], A[1009], B[1009]; int main() { int N, K; scanf("%d%d",&N,&K); scanf(" %s %s %s", S+1, A, B); if(K == 0) { int s = 1, ans = 0; bool a = 1, b = 1; for(int i=1; i<N; i++) { if(S[i] == 'L') { s *= 2; s %= MOD; if(a && A[i] == '1') goto hell1; if(B[i] == '1') b = 0; } if(S[i] == 'R') { s = s * 2 + 1; s %= MOD; if(b && B[i] == '0') goto hell1; if(A[i] == '0') a = 0; } } ans += s; hell1:; s = 1; a = 1, b = 1; for(int i=1; i<N; i++) { if(S[i] == 'R') { s *= 2; s %= MOD; if(a && A[i] == '1') goto hell2; if(B[i] == '1') b = 0; } if(S[i] == 'L') { s = s * 2 + 1; s %= MOD; if(b && B[i] == '0') goto hell2; if(A[i] == '0') a = 0; } } ans += s; ans %= MOD; hell2:; printf("%d", ans); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Incorrect | 2 ms | 384 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |