Task: | Forgotten measurements |
Sender: | Taffa Spaghetti |
Submission time: | 2024-11-16 13:37:52 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | WRONG ANSWER | 0.03 s | details |
#7 | ACCEPTED | 0.03 s | details |
#8 | ACCEPTED | 0.03 s | details |
#9 | WRONG ANSWER | 0.03 s | details |
#10 | ACCEPTED | 0.03 s | details |
#11 | WRONG ANSWER | 0.03 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 35 | for (int i = 2; i < n.size(); i++) { | ~~^~~~~~~~~~ input/code.cpp:36:23: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized] 36 | if (n[i] == f || n[i] == s)
Code
#include <bits/stdc++.h> using namespace std; #define endl "\n"; #define PRINT_ARR(arr, n) \ do { \ for (int i = 0; i < n; i++) { \ cout << arr[i] << " "; \ } \ cout << endl; \ } while (0) typedef long long ll; int main() { string n; cin >> n; char f; switch(n[0]) { case 'U': f='D'; break; case 'D': f='U'; break; case 'L': f='R'; break; case 'R': f='L'; break; } char s=n[1]; ll count = 1ll; for (int i = 2; i < n.size(); i++) { if (n[i] == f || n[i] == s) count++; } cout << count << endl; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ULDRUR |
correct output |
---|
2 |
user output |
---|
2 |
Test 2
Verdict: ACCEPTED
input |
---|
RULD |
correct output |
---|
2 |
user output |
---|
2 |
Test 3
Verdict: ACCEPTED
input |
---|
RULDRURDRURDLULD |
correct output |
---|
7 |
user output |
---|
7 |
Test 4
Verdict: WRONG ANSWER
input |
---|
LDLDRDLULULURURURULDRDLDRDRURD... |
correct output |
---|
19 |
user output |
---|
21 |
Test 5
Verdict: ACCEPTED
input |
---|
RURULDLULDRURDLULDRULURULURDLD... |
correct output |
---|
470 |
user output |
---|
470 |
Test 6
Verdict: WRONG ANSWER
input |
---|
DRULDLULDLULDLURDRULDRURDLURDL... |
correct output |
---|
499773 |
user output |
---|
500211 |
Test 7
Verdict: ACCEPTED
input |
---|
DLURDLULDLULDRULURULURURDLDLDR... |
correct output |
---|
499383 |
user output |
---|
499383 |
Test 8
Verdict: ACCEPTED
input |
---|
RULDLDLDRULDLDLULURULULDLURDLU... |
correct output |
---|
499622 |
user output |
---|
499622 |
Test 9
Verdict: WRONG ANSWER
input |
---|
RDRDRURDLDLURDRULURDLDRULDLULU... |
correct output |
---|
499788 |
user output |
---|
500208 |
Test 10
Verdict: ACCEPTED
input |
---|
LDLURDRURDRULDLULDLDRURDLULDRU... |
correct output |
---|
499368 |
user output |
---|
499368 |
Test 11
Verdict: WRONG ANSWER
input |
---|
DRULULDRDLDLDLURULDRDLURULULDR... |
correct output |
---|
499790 |
user output |
---|
499916 |