Task: | HIIT Generation |
Sender: | Ukkonen Fan Club |
Submission time: | 2018-05-26 11:22:47 +0300 |
Language: | C++ |
Status: | READY |
Result: | OUTPUT LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.03 s | details |
#2 | ACCEPTED | 0.07 s | details |
#3 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#4 | ACCEPTED | 0.01 s | details |
Code
#include<bits/stdc++.h> using namespace std; int n; int H[1222333]; int I[1222333]; int T[1222333]; char t[1222333]; void r(int p){ if (H[p]==n+1) cout << "H"; else r(H[p]); if (I[p]==n+1) cout << "II"; else r(I[p]), r(I[p]); if (T[p]==n+1) cout << "T"; else r(T[p]), r(T[p]); } int main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin >> n; for (int i=0;i<n;++i) cin >> t[i]; H[n]=n+1; I[n]=n+1; T[n]=n+1; for (int i=n-1;i>=0;--i){ H[i]=H[i+1]; I[i]=I[i+1]; T[i]=T[i+1]; if (t[i]=='H') H[i]=i+1; if (t[i]=='I') I[i]=i+1; if (t[i]=='T') T[i]=i+1; } r(0); cout << "\n"; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
17 I I I I ... |
correct output |
---|
HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
user output |
---|
HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
Test 2
Verdict: ACCEPTED
input |
---|
333332 H H H H ... |
correct output |
---|
HIITIITIITIITIITIITIITIITIITII... |
user output |
---|
HIITIITIITIITIITIITIITIITIITII... |
Test 3
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
24 H T H T ... |
correct output |
---|
HIIHIITIIHIIHIITIIHIITIIHIIHII... |
user output |
---|
(empty) |
Test 4
Verdict: ACCEPTED
input |
---|
0 |
correct output |
---|
HIIT |
user output |
---|
HIIT |