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 15:08:11
2017-05-27 14:59:13
2017-05-27 13:45:44
Task:HIIT game
Sender:IOG
Submission time:2017-05-27 15:08:11
Language:C++
Status:READY
Result:TIME LIMIT EXCEEDED

Test results

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

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
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: TIME LIMIT EXCEEDED

input
HIITHIITHIITHIITHIITHIITHIITHI...
view   save

correct output
Uolevi
view   save

user output
(no output)
view   save

Test 6

Verdict: TIME LIMIT EXCEEDED

input
HIITHIITHIITHIITHIITHIITHIITHI...
view   save

correct output
Maija
view   save

user output
(no output)
view   save

Test 7

Verdict: ACCEPTED

input
HITIHITIHITIHITIHITIHITIHITIHI...
view   save

correct output
Maija
view   save

user output
Maija
view   save

Test 8

Verdict: TIME LIMIT EXCEEDED

input
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI...
view   save

correct output
Uolevi
view   save

user output
(no output)
view   save

Test 9

Verdict: TIME LIMIT EXCEEDED

input
HIHIHIHIHIHIHIHIHIHIHIHIHIHIHI...
view   save

correct output
Maija
view   save

user output
(no output)
view   save

Test 10

Verdict: WRONG ANSWER

input
THIITIHIIHHTIITIIITITTTHIHITHH...
view   save

correct output
Maija
view   save

user output
Uolevi
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: WRONG ANSWER

input
ITTHHIIHIITTIHIIHTIHIITHHITITT...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save

Test 16

Verdict: ACCEPTED

input
HIIIHHITITTTHHIIHTIHIITITTITHI...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 17

Verdict: WRONG ANSWER

input
HIITHHIITHHITHIITITIITHIITHHII...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save

Test 18

Verdict: ACCEPTED

input
HIIHIITTTHHIITIIHHITITTHHIIITH...
view   save

correct output
Uolevi
view   save

user output
Uolevi
view   save

Test 19

Verdict: WRONG ANSWER

input
IHHIITHIITHTHHIITHIHHIIHTIHHHI...
view   save

correct output
Maija
view   save

user output
Uolevi
view   save

Test 20

Verdict: WRONG ANSWER

input
HIITHIIHIITTHIITHHHIIHTHIHIHII...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save

Test 21

Verdict: WRONG ANSWER

input
THHTHIITHHHIITIITHHIITIHIITIHI...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save

Test 22

Verdict: WRONG ANSWER

input
IHIITIHIHIIHTHHIIIITTTTHHIITHI...
view   save

correct output
Maija
view   save

user output
Uolevi
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: WRONG ANSWER

input
IHIITHTHIITHIHIHHTHIITIHIHITIT...
view   save

correct output
Maija
view   save

user output
Uolevi
view   save

Test 28

Verdict: WRONG ANSWER

input
HIITIITHIHHIITIHHIHIITITHIITHH...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save

Test 29

Verdict: WRONG ANSWER

input
HHHHIITIITHTITHIHIHITITHHIITII...
view   save

correct output
Uolevi
view   save

user output
Maija
view   save