Task: | HIIT Generation |
Sender: | KnowYourArchitecture |
Submission time: | 2018-05-26 12:49:51 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.07 s | details |
#2 | WRONG ANSWER | 0.15 s | details |
#3 | WRONG ANSWER | 0.05 s | details |
#4 | ACCEPTED | 0.02 s | details |
Code
#include <bits/stdc++.h> using namespace std; int n; char chr[10000001]; int nexti[4][10000001]; void r(int i) { for(auto c : "HIIT") { int ni = -1; if(i < n) { if(c == 'H') ni = nexti[0][i]; if(c == 'I') ni = nexti[1][i]; if(c == 'T') ni = nexti[2][i]; } if(ni == -1) { cout << c; } else { r(ni+1); } } } int main() { cin >> n; for(int j=0;j<n;j++) { cin >> chr[j]; } int ph=-1,pi=-1,pt=-1; for(int j=n-1;j>=0;j--) { if(chr[j] == 'H') ph=j; if(chr[j] == 'I') pi=j; if(chr[j] == 'T') pt=j; nexti[0][j] = ph; nexti[1][j] = pi; nexti[2][j] = pt; } r(0); cout << endl; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
17 I I I I ... |
correct output |
---|
HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
user output |
---|
HHHHHHHHHHHHHHHHHHIIT HIIT T H... |
Test 2
Verdict: WRONG ANSWER
input |
---|
333332 H H H H ... |
correct output |
---|
HIITIITIITIITIITIITIITIITIITII... |
user output |
---|
HIIT IIT IIT IIT IIT IIT IIT I... |
Test 3
Verdict: WRONG ANSWER
input |
---|
24 H T H T ... |
correct output |
---|
HIIHIITIIHIIHIITIIHIITIIHIIHII... |
user output |
---|
HIIHIIT IIHIIHIIT IIHIIT I... |
Test 4
Verdict: ACCEPTED
input |
---|
0 |
correct output |
---|
HIIT |
user output |
---|
HIIT |