QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#322313 | #6768. Nihongo wa Muzukashii Desu | mshcherba# | AC ✓ | 1ms | 3804kb | C++20 | 1.1kb | 2024-02-06 20:10:33 | 2024-02-06 20:10:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
string f(const string& s, string t)
{
if (SZ(s) >= SZ(t) && s.substr(SZ(s) - SZ(t), SZ(t)) == t)
return s.substr(0, SZ(s) - SZ(t));
return "";
}
void solve()
{
string s;
cin >> s;
if (s == "ikimasu")
{
cout << "itte\n";
return;
}
vector<vector<string>> masu = {{"chimasu", "rimasu"}, {"mimasu", "bimasu", "nimasu"}, {"kimasu"}, {"gimasu"}, {"shimasu"}};
vector<string> te = {"tte", "nde", "ite", "ide", "shite"};
FOR(i, 0, 5)
{
string t;
for (string r : masu[i])
t += f(s, r);
if (!t.empty())
{
cout << t << te[i] << "\n";
return;
}
}
assert(false);
}
int main()
{
ios::sync_with_stdio(0);
cin.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: 100
Accepted
time: 1ms
memory: 3804kb
input:
10 machimasu kaerimasu nomimasu yobimasu shinimasu kakimasu ikimasu kikimasu isogimasu kashimasu
output:
matte kaette nonde yonde shinde kaite itte kiite isoide kashite
result:
ok 10 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
63 machimasu kaerimasu nomimasu yobimasu shinimasu kakimasu ikimasu isogimasu kashimasu hatarakimasu yasumimasu owarimasu yomimasu kikimasu torimasu okurimasu kirimasu karimasu arimasu kakarimasu asobimasu oyogimasu kawakimasu sukimasu mochimasu hanashimasu hurimasu hairimasu suwarimasu tachimasu ke...
output:
matte kaette nonde yonde shinde kaite itte isoide kashite hataraite yasunde owatte yonde kiite totte okutte kitte katte atte kakatte asonde oyoide kawaite suite motte hanashite hutte haitte suwatte tatte keshite shitte sunde omoikishite oite utte tsukutte notte oshite oroshite dashite kaeshite meide...
result:
ok 63 lines