# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80305 | 2018-10-19T22:42:20 Z | Plurm | Board (CEOI13_board) | C++11 | 4 ms | 764 KB |
#include <bits/stdc++.h> using namespace std; char a[100005]; char b[100005]; inline int mmove(int x,char y){ switch(y){ case '1': x *= 2; break; case '2': x *= 2; x++; break; case 'U': x /= 2; break; case 'L': x--; break; case 'R': x++; break; } return x; } inline int glv(int x){ int l = 0; while(x > 1){ x /= 2; l++; } return l; } int mem[100005]; int main(){ gets(a); gets(b); int ma = 1; int mb = 1; for(int i = 0; a[i]; i++){ if(ma <= 1e8) ma = mmove(ma,a[i]); } for(int i = 0; b[i]; i++){ if(mb <= 1e8) mb = mmove(mb,b[i]); } int lla = glv(ma); int llb = glv(mb); if(lla < llb){ swap(lla,llb); swap(ma,mb); } int la = lla; int lb = llb; while(ma >= 1){ mem[la] = ma; ma /= 2; la--; } int d = 1e9; while(mb >= 1){ if(mem[lb]){ d = min(d,abs(mem[lb] - mb) + lla - lb + llb - lb); } mb /= 2; lb--; } printf("%d\n",d); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 576 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 624 KB | Output is correct |
2 | Correct | 3 ms | 700 KB | Output is correct |
3 | Correct | 4 ms | 700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 764 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 764 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 764 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |