QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656383 | #8048. Roman Master | ucup-team4992# | WA | 21ms | 3668kb | C++20 | 893b | 2024-10-19 12:43:18 | 2024-10-19 12:43:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
string str;
int num[N];
int pos;
void solve(){
cin>>str;
int n=str.length(),res=0;
pos=0;
for(int i=n-1; i>=0; i--){
if(str[i]=='V'){
if(res==0) res=5;
else{
num[++pos]=res+5;
res=0;
}
}else{
if(res==4){
num[++pos]=4;
res=1;
}
else if(res==5) res--;
else if(res==3){
num[++pos]=3;
res=1;
}else res++;
}
}
if(res) num[++pos]=res,res=0;
for(int i=pos; i; i--) cout<<num[i];
cout<<"\n";
return;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int T=1;
cin>>T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
input:
3 II IVI VIIIIIV
output:
2 16 634
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 21ms
memory: 3668kb
input:
100000 VVIVVVVVII VVVIIIIVVI IVIIVIIIIV VVVVVIIVVI IIIVIVVVIV VIVIIIIIVI VVIIVVIVVI IVVVIVVVVV VIIVVVVIVV VIIIIVVVVV VVVVVVIVIV VIVIIIVVVI VIIIVIVVVI VIIIIVVIIV VIVVVIIVII IIIIIVIIVI IIIIVVVVII IVIIVVIIVI IVVIVVIIIV IVVVIIIVIV IIIIVIIIVV VVVVVIVIIV VVVIIIIVVV VIVVIIIIVI VIIIIIIIIV VIVIVVVIVV IVIIIVI...
output:
5610107 10846 1784 1010646 36109 6736 56496 11091010 6410610 841010 5101069 68106 86106 8464 61077 2376 34107 16476 4974 11089 13810 1010664 108410 9636 6334 6610610 1863 27710 34710 9746 10106410 47310 3746 7496 6633 91069 738 4776 8666 2106610 101010106 16669 1107610 5733 488 91069 6336 1748 16966...
result:
wrong answer 1st lines differ - expected: '5545557', found: '5610107'