# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384268 | 2021-04-01T04:51:58 Z | ijxjdjd | Board (CEOI13_board) | C++17 | 7 ms | 1256 KB |
#include <bits/stdc++.h> #define FR(i, N) for (int i = 0; i < int(N); i++) #define all(x) begin(x), end(x) using namespace std; using ll = long long; vector<int> parse(string s) { vector<int> res; res.push_back(1); for (char c : s) { if (c == '1') { res.push_back(0); } else if (c == '2') { res.push_back(1); } else if (c == 'U') { res.pop_back(); } else if (c == 'L') { for (int j = res.size()-1; j >= 0; j--) { if (res[j] != 0) { res[j] = 0; for (int k = j+1; k < res.size(); k++) { res[k] = 1; } break; } } } else if (c == 'R') { for (int j = res.size()-1; j >= 0; j--) { if (res[j] == 0) { res[j] = 1; for (int k = j+1; k < res.size(); k++) { res[k] = 1; } break; } } } } return res; } int main() { cin.tie(0); cin.sync_with_stdio(0); string A; string B; cin >> A >> B; vector<int> sA = parse(A); vector<int> sB = parse(B); if (sA.size() < sB.size()) { swap(sA, sB); } int d = 0; while (sA.size() > sB.size()) { sA.pop_back(); d++; } if (sA > sB) { swap(sA, sB); } int res = (int)(1e9); int diff = 0; for (int k = 0; k < sA.size(); k++) { diff *= 2; diff += sB[k]-sA[k]; // if (diff >= 1000000) { // break; // } res = min((int(sA.size())-k-1)*2+d+diff, res); } cout << res << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 1144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |