Task: | HIIT game |
Sender: | Nää jäbät |
Submission time: | 2017-05-27 11:42:03 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.04 s | details |
#2 | ACCEPTED | 0.08 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.10 s | details |
#6 | ACCEPTED | 0.09 s | details |
#7 | ACCEPTED | 0.10 s | details |
#8 | ACCEPTED | 0.12 s | details |
#9 | ACCEPTED | 0.10 s | details |
#10 | ACCEPTED | 0.05 s | details |
#11 | ACCEPTED | 0.04 s | details |
#12 | ACCEPTED | 0.06 s | details |
#13 | ACCEPTED | 0.06 s | details |
#14 | ACCEPTED | 0.04 s | details |
#15 | ACCEPTED | 0.05 s | details |
#16 | ACCEPTED | 0.05 s | details |
#17 | ACCEPTED | 0.06 s | details |
#18 | ACCEPTED | 0.06 s | details |
#19 | ACCEPTED | 0.05 s | details |
#20 | ACCEPTED | 0.04 s | details |
#21 | ACCEPTED | 0.05 s | details |
#22 | ACCEPTED | 0.05 s | details |
#23 | ACCEPTED | 0.04 s | details |
#24 | ACCEPTED | 0.07 s | details |
#25 | ACCEPTED | 0.04 s | details |
#26 | ACCEPTED | 0.07 s | details |
#27 | ACCEPTED | 0.04 s | details |
#28 | ACCEPTED | 0.04 s | details |
#29 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'int f(int, int)': input/code.cpp:13:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (e[i] || i == s.length() - 4) return NIL; ^ input/code.cpp: In function 'int main()': input/code.cpp:65:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < s.length() - 4; i++) { ^
Code
#include <bits/stdc++.h> #define ll long long using namespace std; string s; int e[1111111]; int NIL = 13371337; int am = 0; int f (int i, int k) { if (e[i] || i == s.length() - 4) return NIL; e[i] = 1; if (k == 0) { if (s[i] != 'H') e[i] = 0; if (s[i] != 'H') return NIL; int y = i; while (s[y + 1] == 'H') { int x = f(y + 1, 0); if (x == NIL) e[i] = 0; if (x == NIL) return NIL; y = x; } int x = f(y + 1, k + 1); if (x == NIL) e[i] = 0; return x; } else if (k == 3) { if (s[i] != 'T') e[i] = 0; if (s[i] != 'T') return NIL; am++; return i; } else { if (s[i] != 'I') e[i] = 0; if (s[i] != 'I') return NIL; if (k == 1) { int y = i; while (s[y + 1] == 'H') { int x = f(y + 1, 0); if (x == NIL) e[i] = 0; if (x == NIL) return NIL; y = x; } int x = f(y + 1, k + 1); if (x == NIL) e[i] = 0; return x; } else { int y = i; while (s[y + 1] == 'H') { int x = f(y + 1, 0); if (x == NIL) e[i] = 0; if (x == NIL) return NIL; y = x; } int x = f(y + 1, k + 1); if (x == NIL) e[i] = 0; return x; } } } int main () { cin>>s; s += "####"; for (int i = 0; i < s.length() - 4; i++) { if (s[i] == 'H') { f(i, 0); } } /*for (int i = 0; i < s.length() - 4; i++) { cout<<e[i]; } cout<<endl; cout<<am<<endl;*/ if (am % 2) cout<<"Uolevi"<<endl; else cout<<"Maija"<<endl; }
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: ACCEPTED
input |
---|
HIITHIITHIITHIITHIITHIITHIITHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 6
Verdict: ACCEPTED
input |
---|
HIITHIITHIITHIITHIITHIITHIITHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 7
Verdict: ACCEPTED
input |
---|
HITIHITIHITIHITIHITIHITIHITIHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 8
Verdict: ACCEPTED
input |
---|
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 9
Verdict: ACCEPTED
input |
---|
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 10
Verdict: ACCEPTED
input |
---|
THIITIHIIHHTIITIIITITTTHIHITHH... |
correct output |
---|
Maija |
user output |
---|
Maija |
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: ACCEPTED
input |
---|
ITTHHIIHIITTIHIIHTIHIITHHITITT... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 16
Verdict: ACCEPTED
input |
---|
HIIIHHITITTTHHIIHTIHIITITTITHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 17
Verdict: ACCEPTED
input |
---|
HIITHHIITHHITHIITITIITHIITHHII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 18
Verdict: ACCEPTED
input |
---|
HIIHIITTTHHIITIIHHITITTHHIIITH... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 19
Verdict: ACCEPTED
input |
---|
IHHIITHIITHTHHIITHIHHIIHTIHHHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 20
Verdict: ACCEPTED
input |
---|
HIITHIIHIITTHIITHHHIIHTHIHIHII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 21
Verdict: ACCEPTED
input |
---|
THHTHIITHHHIITIITHHIITIHIITIHI... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 22
Verdict: ACCEPTED
input |
---|
IHIITIHIHIIHTHHIIIITTTTHHIITHI... |
correct output |
---|
Maija |
user output |
---|
Maija |
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: ACCEPTED
input |
---|
IHIITHTHIITHIHIHHTHIITIHIHITIT... |
correct output |
---|
Maija |
user output |
---|
Maija |
Test 28
Verdict: ACCEPTED
input |
---|
HIITIITHIHHIITIHHIHIITITHIITHH... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |
Test 29
Verdict: ACCEPTED
input |
---|
HHHHIITIITHTITHIHIHITITHHIITII... |
correct output |
---|
Uolevi |
user output |
---|
Uolevi |