# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
62424 | 2018-07-28T12:40:03 Z | Nnandi | 게임판 (CEOI13_board) | C++14 | 200 ms | 2492 KB |
#include <bits/stdc++.h> #define INF 1000000000 using namespace std; string s1, s2; vector<bool> v1, v2; void get_exp(string &str, vector<bool> &vb) { vb.push_back(true); for(char c:str) { if(c=='1') { vb.push_back(false); } if(c=='2') { vb.push_back(true); } if(c=='U') { vb.resize(vb.size()-1); } if(c=='R') { int it=vb.size()-1; while(it >= 0 && vb[it] == true) { it--; } vb[it]=true; it++; for(;it<vb.size();it++) { vb[it] =false; } } if(c=='L') { int it=vb.size()-1; while(it >= 0 && vb[it] == false) { it--; } vb[it]=false; it++; for(;it<vb.size();it++) { vb[it] =true; } } } return; } int main() { ios_base::sync_with_stdio(false); cin>>s1; cin>>s2; get_exp(s1,v1); get_exp(s2,v2); int dist_min = v1.size() -1 + v2.size() -1; bool kell = true; int elt = 0; for(int i=0;i<min(v1.size(),v2.size()) && kell;i++) { elt *= 2; if(v2[i] && !v1[i]) { elt ++; } if(!v2[i] && v1[i]) { elt --; } int now_cost = v1.size() + v2.size() - 2*(i+1) + abs(elt); if(dist_min > now_cost) { dist_min = now_cost; } if(now_cost > INF) { kell = false; } } cout<<dist_min<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 500 KB | Output is correct |
3 | Correct | 2 ms | 576 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 776 KB | Output is correct |
2 | Correct | 3 ms | 776 KB | Output is correct |
3 | Correct | 5 ms | 1232 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1232 KB | Output is correct |
2 | Correct | 2 ms | 1232 KB | Output is correct |
3 | Correct | 3 ms | 1232 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1232 KB | Output is correct |
2 | Correct | 6 ms | 1476 KB | Output is correct |
3 | Correct | 5 ms | 1476 KB | Output is correct |
4 | Correct | 2 ms | 1476 KB | Output is correct |
5 | Correct | 3 ms | 1476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1476 KB | Output is correct |
2 | Correct | 2 ms | 1476 KB | Output is correct |
3 | Correct | 3 ms | 1476 KB | Output is correct |
4 | Correct | 2 ms | 1476 KB | Output is correct |
5 | Correct | 2 ms | 1476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1476 KB | Output is correct |
2 | Correct | 3 ms | 1476 KB | Output is correct |
3 | Correct | 3 ms | 1476 KB | Output is correct |
4 | Correct | 2 ms | 1476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1476 KB | Output is correct |
2 | Correct | 6 ms | 1764 KB | Output is correct |
3 | Correct | 5 ms | 1804 KB | Output is correct |
4 | Correct | 3 ms | 1804 KB | Output is correct |
5 | Correct | 2 ms | 1804 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 2168 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1081 ms | 2492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 2492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |