QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772448 | #8048. Roman Master | thangthang | WA | 0ms | 3524kb | C++20 | 1.1kb | 2024-11-22 19:37:38 | 2024-11-22 19:37:38 |
Judging History
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'