Task: | Forgotten measurements |
Sender: | ht |
Submission time: | 2024-11-16 12:19:09 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
#7 | WRONG ANSWER | 0.01 s | details |
#8 | WRONG ANSWER | 0.01 s | details |
#9 | WRONG ANSWER | 0.01 s | details |
#10 | WRONG ANSWER | 0.01 s | details |
#11 | WRONG ANSWER | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define all(x) x.begin(), x.end() #define rep(i,a,b) for(int i=a; i<=b; i++) int main(){ ios::sync_with_stdio(0); string s; s.reserve(1000000); cin >> s; ll ldu = 0, ldl = 0, udu = 0, udl = 0; ll ld = 0, ud = 0; for(char c : s){ switch(c){ case 'U': ud ++; break; case 'D': ud --; break; case 'L': ld --; break; case 'R': ld ++; break; default: break; } ldu = max(ldu, ld); ldl = min(ldl, ld); udu = max(udu, ud); udl = min(udl, ud); } ud = abs(udu - udl); ld = abs(ldu - ldl); cout << (ud + ld) << "\n"; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
ULDRUR |
correct output |
---|
2 |
user output |
---|
3 |
Test 2
Verdict: ACCEPTED
input |
---|
RULD |
correct output |
---|
2 |
user output |
---|
2 |
Test 3
Verdict: WRONG ANSWER
input |
---|
RULDRURDRURDLULD |
correct output |
---|
7 |
user output |
---|
5 |
Test 4
Verdict: WRONG ANSWER
input |
---|
LDLDRDLULULURURURULDRDLDRDRURD... |
correct output |
---|
19 |
user output |
---|
12 |
Test 5
Verdict: WRONG ANSWER
input |
---|
RURULDLULDRURDLULDRULURULURDLD... |
correct output |
---|
470 |
user output |
---|
73 |
Test 6
Verdict: WRONG ANSWER
input |
---|
DRULDLULDLULDLURDRULDRURDLURDL... |
correct output |
---|
499773 |
user output |
---|
1141 |
Test 7
Verdict: WRONG ANSWER
input |
---|
DLURDLULDLULDRULURULURURDLDLDR... |
correct output |
---|
499383 |
user output |
---|
1818 |
Test 8
Verdict: WRONG ANSWER
input |
---|
RULDLDLDRULDLDLULURULULDLURDLU... |
correct output |
---|
499622 |
user output |
---|
1145 |
Test 9
Verdict: WRONG ANSWER
input |
---|
RDRDRURDLDLURDRULURDLDRULDLULU... |
correct output |
---|
499788 |
user output |
---|
897 |
Test 10
Verdict: WRONG ANSWER
input |
---|
LDLURDRURDRULDLULDLDRURDLULDRU... |
correct output |
---|
499368 |
user output |
---|
1729 |
Test 11
Verdict: WRONG ANSWER
input |
---|
DRULULDRDLDLDLURULDRDLURULULDR... |
correct output |
---|
499790 |
user output |
---|
1191 |