QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#782744#8048. Roman MasterCoffinsWA 0ms3576kbC++14983b2024-11-25 21:14:042024-11-25 21:14:15

Judging History

你现在查看的是最新测评结果

  • [2024-11-25 21:14:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3576kb
  • [2024-11-25 21:14:04]
  • 提交

answer

#include<bits/stdc++.h>
#define All(x) x.begin(),x.end()
using namespace std;
using ull=unsigned long long;
using ll=long long;
using bint=__int128;
using ld=long double;
using pii=pair<int,int>;
using vi=vector<int>;
const int N=1e5+5;
int n;char s[N];
int pr[N],ls[N],c[N];
void solve()
{
    cin>>s+1;n=strlen(s+1);int ps=0;
    for(int i=1;i<=n;i++)
    {if(s[i]=='V')ps=i;pr[i]=ps;}
    for(int i=1;i<=n;i++)
    {
        if(pr[i]<=i-4)ls[i]=n-3,c[i]=3;
        else if(!pr[i])ls[i]=0,c[i]=i;
        else if(pr[i]==i-3)ls[i]=i-4,c[i]=8;
        else if(pr[i]==i-2)ls[i]=i-3,c[i]=7;
        else if(pr[i]==i-1)ls[i]=i-2,c[i]=6;
        else if(s[i-1]=='I')ls[i]=i-2,c[i]=4;
        else ls[i]=i-1,c[i]=5;
    }vector<int> vc;int s=n;
    while(s)vc.push_back(c[s]),s=ls[s];
    reverse(All(vc));for(int c:vc)
    cout<<c;cout<<'\n';
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t;cin>>t;while(t--)solve();return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

input:

3
II
IVI
VIIIIIV

output:

2
16
834

result:

wrong answer 3rd lines differ - expected: '634', found: '834'