Code Submission Evaluation System Login

HIIT Open 2017

Start:2017-05-27 11:00:00
End:2017-05-27 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2017 - Results
History
2017-05-27 11:42:03
2017-05-27 11:33:16
Task:HIIT game
Sender:Nää jäbät
Submission time:2017-05-27 11:42:03
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.04 / 1.00details
#2ACCEPTED0.08 / 1.00details
#3ACCEPTED0.05 / 1.00details
#4ACCEPTED0.06 / 1.00details
#5ACCEPTED0.10 / 1.00details
#6ACCEPTED0.09 / 1.00details
#7ACCEPTED0.10 / 1.00details
#8ACCEPTED0.12 / 1.00details
#9ACCEPTED0.10 / 1.00details
#10ACCEPTED0.05 / 1.00details
#11ACCEPTED0.04 / 1.00details
#12ACCEPTED0.06 / 1.00details
#13ACCEPTED0.06 / 1.00details
#14ACCEPTED0.04 / 1.00details
#15ACCEPTED0.05 / 1.00details
#16ACCEPTED0.05 / 1.00details
#17ACCEPTED0.06 / 1.00details
#18ACCEPTED0.06 / 1.00details
#19ACCEPTED0.05 / 1.00details
#20ACCEPTED0.04 / 1.00details
#21ACCEPTED0.05 / 1.00details
#22ACCEPTED0.05 / 1.00details
#23ACCEPTED0.04 / 1.00details
#24ACCEPTED0.07 / 1.00details
#25ACCEPTED0.04 / 1.00details
#26ACCEPTED0.07 / 1.00details
#27ACCEPTED0.04 / 1.00details
#28ACCEPTED0.04 / 1.00details
#29ACCEPTED0.05 / 1.00details

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
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 2

Verdict: ACCEPTED

input
TIIH
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 3

Verdict: ACCEPTED

input
HIITHIIT
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 4

Verdict: ACCEPTED

input
HIHIHIHI
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 5

Verdict: ACCEPTED

input
HIITHIITHIITHIITHIITHIITHIITHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 6

Verdict: ACCEPTED

input
HIITHIITHIITHIITHIITHIITHIITHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 7

Verdict: ACCEPTED

input
HITIHITIHITIHITIHITIHITIHITIHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 8

Verdict: ACCEPTED

input
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 9

Verdict: ACCEPTED

input
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 10

Verdict: ACCEPTED

input
THIITIHIIHHTIITIIITITTTHIHITHH...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 11

Verdict: ACCEPTED

input
HIHHHIITHTHIITIIHIIHIITITTIHII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 12

Verdict: ACCEPTED

input
HTHIITHHHHIHITIIIHIITHHIIHIITT...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 13

Verdict: ACCEPTED

input
IHIITIHHHIIHIITHHHIITHIITIHIIT...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 14

Verdict: ACCEPTED

input
HHHIHHHIITHIITHHIHIITHIIIITHII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 15

Verdict: ACCEPTED

input
ITTHHIIHIITTIHIIHTIHIITHHITITT...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 16

Verdict: ACCEPTED

input
HIIIHHITITTTHHIIHTIHIITITTITHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 17

Verdict: ACCEPTED

input
HIITHHIITHHITHIITITIITHIITHHII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 18

Verdict: ACCEPTED

input
HIIHIITTTHHIITIIHHITITTHHIIITH...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 19

Verdict: ACCEPTED

input
IHHIITHIITHTHHIITHIHHIIHTIHHHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 20

Verdict: ACCEPTED

input
HIITHIIHIITTHIITHHHIIHTHIHIHII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 21

Verdict: ACCEPTED

input
THHTHIITHHHIITIITHHIITIHIITIHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 22

Verdict: ACCEPTED

input
IHIITIHIHIIHTHHIIIITTTTHHIITHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 23

Verdict: ACCEPTED

input
HIIIHIITTHIIHIIITTHHTHHHHHIIHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 24

Verdict: ACCEPTED

input
HIHHIHIHIITHIIITITIHIHIITITIHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 25

Verdict: ACCEPTED

input
HIITHIHIHIIHIITTHIHHIITIITIHII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 26

Verdict: ACCEPTED

input
HHHITITHTHHIHTITIHHIITHIITIITH...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 27

Verdict: ACCEPTED

input
IHIITHTHIITHIHIHHTHIITIHIHITIT...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 28

Verdict: ACCEPTED

input
HIITIITHIHHIITIHHIHIITITHIITHH...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 29

Verdict: ACCEPTED

input
HHHHIITIITHTITHIHIHITITHHIITII...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save