Task: | Forgotten measurements |
Sender: | CPLX |
Submission time: | 2024-11-16 13:55:28 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | WRONG ANSWER | 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.03 s | details |
#7 | WRONG ANSWER | 0.03 s | details |
#8 | WRONG ANSWER | 0.03 s | details |
#9 | WRONG ANSWER | 0.03 s | details |
#10 | WRONG ANSWER | 0.03 s | details |
#11 | WRONG ANSWER | 0.03 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:30:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 30 | for(ll i=0; i<s.size(); i +=2){ | ~^~~~~~~~~
Code
#include <iostream> #include <string> #include <bits/stdc++.h> #include <algorithm> using namespace std; typedef long long ll; #define UPLEFT 0 #define UPRIGHT 1 #define DOWNLEFT 2 #define DOWNRIGHT 3 // ll max(ll a, ll b){ // if(a>b)return a; // return b; // } int main(){ string s; cin >> s; vector<ll> count(4,0); for(ll i=0; i<s.size(); i +=2){ if(s[i]=='U' and s[i+1]=='L')count[UPLEFT] +=1; else if(s[i]=='L' and s[i+1]=='U')count[UPLEFT] +=1; else if(s[i]=='U' and s[i+1]=='R')count[UPRIGHT] +=1; else if(s[i]=='R' and s[i+1]=='U')count[UPRIGHT] +=1; else if(s[i]=='D' and s[i+1]=='L')count[DOWNLEFT] +=1; else if(s[i]=='L' and s[i+1]=='D')count[DOWNLEFT] +=1; else if(s[i]=='D' and s[i+1]=='R')count[DOWNRIGHT] +=1; else if(s[i]=='R' and s[i+1]=='D')count[DOWNRIGHT] +=1; } cout << max(count[UPLEFT], count[DOWNRIGHT]) + max(count[UPRIGHT], count[DOWNLEFT]) << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ULDRUR |
correct output |
---|
2 |
user output |
---|
2 |
Test 2
Verdict: WRONG ANSWER
input |
---|
RULD |
correct output |
---|
2 |
user output |
---|
1 |
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 |
---|
11 |
Test 5
Verdict: WRONG ANSWER
input |
---|
RURULDLULDRURDLULDRULURULURDLD... |
correct output |
---|
470 |
user output |
---|
266 |
Test 6
Verdict: WRONG ANSWER
input |
---|
DRULDLULDLULDLURDRULDRURDLURDL... |
correct output |
---|
499773 |
user output |
---|
250123 |
Test 7
Verdict: WRONG ANSWER
input |
---|
DLURDLULDLULDRULURULURURDLDLDR... |
correct output |
---|
499383 |
user output |
---|
250492 |
Test 8
Verdict: WRONG ANSWER
input |
---|
RULDLDLDRULDLDLULURULULDLURDLU... |
correct output |
---|
499622 |
user output |
---|
250197 |
Test 9
Verdict: WRONG ANSWER
input |
---|
RDRDRURDLDLURDRULURDLDRULDLULU... |
correct output |
---|
499788 |
user output |
---|
250194 |
Test 10
Verdict: WRONG ANSWER
input |
---|
LDLURDRURDRULDLULDLDRURDLULDRU... |
correct output |
---|
499368 |
user output |
---|
250348 |
Test 11
Verdict: WRONG ANSWER
input |
---|
DRULULDRDLDLDLURULDRDLURULULDR... |
correct output |
---|
499790 |
user output |
---|
250138 |