Task: | HIIT game |
Sender: | IOG |
Submission time: | 2017-05-27 15:08:11 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.07 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.05 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | WRONG ANSWER | 0.04 s | details |
#11 | ACCEPTED | 0.04 s | details |
#12 | ACCEPTED | 0.07 s | details |
#13 | ACCEPTED | 0.05 s | details |
#14 | ACCEPTED | 0.03 s | details |
#15 | WRONG ANSWER | 0.05 s | details |
#16 | ACCEPTED | 0.06 s | details |
#17 | WRONG ANSWER | 0.03 s | details |
#18 | ACCEPTED | 0.06 s | details |
#19 | WRONG ANSWER | 0.03 s | details |
#20 | WRONG ANSWER | 0.06 s | details |
#21 | WRONG ANSWER | 0.05 s | details |
#22 | WRONG ANSWER | 0.04 s | details |
#23 | ACCEPTED | 0.06 s | details |
#24 | ACCEPTED | 0.04 s | details |
#25 | ACCEPTED | 0.04 s | details |
#26 | ACCEPTED | 0.05 s | details |
#27 | WRONG ANSWER | 0.06 s | details |
#28 | WRONG ANSWER | 0.05 s | details |
#29 | WRONG ANSWER | 0.04 s | details |
Code
#include <bits/stdc++.h> using namespace std; inline int findh(string& s, unordered_set<int>& set) { const char* hiit = "HIIT"; int hidx = 0; unsigned int i = 0; int space = 0; //for (auto x : set) // cout << x << endl; for (;i < s.size();) { if (set.count((int)i)) space += 4; if (space == 0) { if (s[i] == hiit[hidx]) { hidx++; } else { hidx = 0; if (s[i] == hiit[hidx]) hidx++; } } //cout << hidx << endl; if (hidx == 4) return (i - 3); i++; if (space > 0) --space; } return -1; } int main(void) { cin.sync_with_stdio(0); cin.tie(0); string s; cin >> s; unordered_set<int> set; //int start = 0; int player = 0; for(;;) { //cout << s << endl; int p = findh(s, set); //cout << start << "\n"; //cout << "p " << p << endl; if (p != -1) { player += 1; set.insert(p); }else { if (player % 2 == 1) cout << "Uolevi" << endl; else cout << "Maija" << endl; return 0; } } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
HIIT |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 2
Verdict: ACCEPTED
input |
---|
TIIH |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 3
Verdict: ACCEPTED
input |
---|
HIITHIIT |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 4
Verdict: ACCEPTED
input |
---|
HIHIHIHI |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
HIITHIITHIITHIITHIITHIITHIITHI... |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
HIITHIITHIITHIITHIITHIITHIITHI... |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 7
Verdict: ACCEPTED
input |
---|
HITIHITIHITIHITIHITIHITIHITIHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI... |
correct output |
---|
Uolevi |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI... |
correct output |
---|
Maija |
user output |
---|
(empty) |
Test 10
Verdict: WRONG ANSWER
input |
---|
THIITIHIIHHTIITIIITITTTHIHITHH... |
correct output |
---|
Maija |
user output |
---|
Uolevi |
Test 11
Verdict: ACCEPTED
input |
---|
HIHHHIITHTHIITIIHIIHIITITTIHII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 12
Verdict: ACCEPTED
input |
---|
HTHIITHHHHIHITIIIHIITHHIIHIITT... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 13
Verdict: ACCEPTED
input |
---|
IHIITIHHHIIHIITHHHIITHIITIHIIT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 14
Verdict: ACCEPTED
input |
---|
HHHIHHHIITHIITHHIHIITHIIIITHII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 15
Verdict: WRONG ANSWER
input |
---|
ITTHHIIHIITTIHIIHTIHIITHHITITT... |
correct output |
---|
Uolevi |
user output |
---|
Maija |
Test 16
Verdict: ACCEPTED
input |
---|
HIIIHHITITTTHHIIHTIHIITITTITHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 17
Verdict: WRONG ANSWER
input |
---|
HIITHHIITHHITHIITITIITHIITHHII... |
correct output |
---|
Uolevi |
user output |
---|
Maija |
Test 18
Verdict: ACCEPTED
input |
---|
HIIHIITTTHHIITIIHHITITTHHIIITH... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 19
Verdict: WRONG ANSWER
input |
---|
IHHIITHIITHTHHIITHIHHIIHTIHHHI... |
correct output |
---|
Maija |
user output |
---|
Uolevi |
Test 20
Verdict: WRONG ANSWER
input |
---|
HIITHIIHIITTHIITHHHIIHTHIHIHII... |
correct output |
---|
Uolevi |
user output |
---|
Maija |
Test 21
Verdict: WRONG ANSWER
input |
---|
THHTHIITHHHIITIITHHIITIHIITIHI... |
correct output |
---|
Uolevi |
user output |
---|
Maija |
Test 22
Verdict: WRONG ANSWER
input |
---|
IHIITIHIHIIHTHHIIIITTTTHHIITHI... |
correct output |
---|
Maija |
user output |
---|
Uolevi |
Test 23
Verdict: ACCEPTED
input |
---|
HIIIHIITTHIIHIIITTHHTHHHHHIIHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 24
Verdict: ACCEPTED
input |
---|
HIHHIHIHIITHIIITITIHIHIITITIHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 25
Verdict: ACCEPTED
input |
---|
HIITHIHIHIIHIITTHIHHIITIITIHII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 26
Verdict: ACCEPTED
input |
---|
HHHITITHTHHIHTITIHHIITHIITIITH... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 27
Verdict: WRONG ANSWER
input |
---|
IHIITHTHIITHIHIHHTHIITIHIHITIT... |
correct output |
---|
Maija |
user output |
---|
Uolevi |
Test 28
Verdict: WRONG ANSWER
input |
---|
HIITIITHIHHIITIHHIHIITITHIITHH... |
correct output |
---|
Uolevi |
user output |
---|
Maija |
Test 29
Verdict: WRONG ANSWER
input |
---|
HHHHIITIITHTITHIHIHITITHHIITII... |
correct output |
---|
Uolevi |
user output |
---|
Maija |