# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25610 | 2017-06-23T08:12:42 Z | Extazy | Board (CEOI13_board) | C++14 | 3 ms | 2276 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1<<17; struct node { int level; long long number; node() { level=0; number=1; } void move(char a) { if(a=='1') { ++level; number=number*2; } else if(a=='2') { ++level; number=number*2+1; } else if(a=='L') { --number; } else if(a=='R') { ++number; } else { //a=='U' --level; number=number/2; } } }; char a[N],b[N]; int n,m; node node1,node2; long long ans,curr; int main() { int i; scanf("%s", a+1); n=strlen(a+1); scanf("%s", b+1); m=strlen(b+1); for(i=1;i<=n;i++) { node1.move(a[i]); } for(i=1;i<=m;i++) { node2.move(b[i]); } ans=node1.level+node2.level; if(node1.level>=1 && node2.level>=1) ans=min(ans,node1.level+node2.level-1ll); curr=0; while(node1.level!=node2.level) { if(node1.level>node2.level) ++curr,node1.move('U'); else ++curr,node2.move('U'); } curr+=max(node1.number,node2.number)-min(node1.number,node2.number); ans=min(ans,curr); printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2276 KB | Output is correct |
2 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2276 KB | Output is correct |
2 | Incorrect | 0 ms | 2276 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2276 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |