QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#772448#8048. Roman MasterthangthangWA 0ms3524kbC++201.1kb2024-11-22 19:37:382024-11-22 19:37:38

Judging History

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

  • [2024-11-22 19:37:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-11-22 19:37:38]
  • 提交

answer

// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

map <string, char> m;

void solve(){
    string a, s, x;
    cin >> a;
    for (int i = a.length(); ~i; i --){
        string t = a[i] + x;
        if (m.find(t) == m.end()) s = m[x] + s, x = a[i];
        else x = t;
    }
    s = m[x] + s;
    cout << s << endl;
}

int main(){
    if (fopen("pqh.inp", "r")){
        freopen("pqh.inp", "r", stdin);
        freopen("pqh.out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    m["I"] = '1', m["II"] = '2', m["III"] = '3', m["IV"] = '4';
    m["V"] = '5', m["VI"] = '6', m["VII"] = '7', m["VIII"] = '8';

    int t = 1; 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: 3524kb

input:

3
II
IVI
VIIIIIV

output:

2

result:

wrong answer 1st lines differ - expected: '2', found: '2'