# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442858 | 2021-07-09T09:33:03 Z | prvocislo | Board (CEOI13_board) | C++17 | 4 ms | 1408 KB |
#include <bits/stdc++.h> using namespace std; vector<int> get(const string &s) { vector<int> v; for (const char &c : s) { if (c == '1') v.push_back(0); if (c == '2') v.push_back(1); if (c == 'L') v.back()--; if (c == 'R') v.back()++; if (c == 'U') { int val = v.back(); v.pop_back(); v.back() += (val >> 1); } } for (int i = v.size() - 1; i > 0; i--) { int val = v[i] >> 1; v[i] -= (val << 1); v[i - 1] += val; } return v; } int main() { ios::sync_with_stdio(false); cin.tie(0); string sa, sb; cin >> sa >> sb; vector<int> a = get(sa), b = get(sb); int dif = 0, dist = a.size() + b.size(), ans = dist; for (int i = 0; i < min(a.size(), b.size()); i++) { dist -= 2; dif <<= 1, dif += a[i] - b[i]; int val = dist + abs(dif); if (val > 1e6) break; ans = min(ans, val); } cout << ans << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 680 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 588 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 4 ms | 716 KB | Output is correct |
3 | Correct | 2 ms | 588 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 3 ms | 716 KB | Output is correct |
3 | Correct | 2 ms | 588 KB | Output is correct |
4 | Correct | 0 ms | 316 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1288 KB | Output is correct |
2 | Correct | 3 ms | 1280 KB | Output is correct |
3 | Correct | 1 ms | 460 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1288 KB | Output is correct |
2 | Correct | 3 ms | 1408 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 1352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1284 KB | Output is correct |
2 | Correct | 3 ms | 1352 KB | Output is correct |
3 | Correct | 2 ms | 1152 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 1352 KB | Output is correct |