CSES - Aalto Competitive Programming 2024 - wk3 - Wed - Results
Submission details
Task:Yet another game
Sender:aalto2024c_006
Submission time:2024-09-18 16:57:22 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.04 sdetails
#30.04 sdetails
#4ACCEPTED0.04 sdetails
#50.04 sdetails
#60.04 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.04 sdetails
#90.04 sdetails
#100.04 sdetails
#110.04 sdetails
#120.04 sdetails
#13ACCEPTED0.04 sdetails
#140.04 sdetails
#150.04 sdetails
#16ACCEPTED0.04 sdetails
#17ACCEPTED0.04 sdetails
#18ACCEPTED0.04 sdetails
#19ACCEPTED0.04 sdetails
#20ACCEPTED0.04 sdetails
#21ACCEPTED0.04 sdetails
#22ACCEPTED0.04 sdetails
#23ACCEPTED0.04 sdetails
#24ACCEPTED0.04 sdetails
#25ACCEPTED0.04 sdetails
#26ACCEPTED0.04 sdetails
#27ACCEPTED0.04 sdetails
#28ACCEPTED0.04 sdetails
#29ACCEPTED0.04 sdetails
#300.04 sdetails
#31ACCEPTED0.04 sdetails
#320.04 sdetails
#33ACCEPTED0.04 sdetails
#34ACCEPTED0.04 sdetails
#350.04 sdetails
#36ACCEPTED0.04 sdetails
#37ACCEPTED0.04 sdetails
#38ACCEPTED0.04 sdetails
#390.04 sdetails
#400.04 sdetails
#41ACCEPTED0.04 sdetails
#420.04 sdetails
#43ACCEPTED0.04 sdetails
#440.04 sdetails
#450.04 sdetails
#46ACCEPTED0.04 sdetails
#470.04 sdetails
#48ACCEPTED0.04 sdetails
#49ACCEPTED0.04 sdetails
#50ACCEPTED0.04 sdetails
#510.04 sdetails
#520.04 sdetails
#53ACCEPTED0.04 sdetails
#540.04 sdetails
#55ACCEPTED0.04 sdetails
#56ACCEPTED0.05 sdetails
#570.05 sdetails
#58ACCEPTED0.05 sdetails
#59ACCEPTED0.09 sdetails
#60ACCEPTED0.10 sdetails
#610.09 sdetails
#620.09 sdetails

Code

def yet_another_game(n,arr):

    # nim_sum = 0
    # for distance in arr:
    #     nim_sum ^= distance
    
    # if nim_sum == 0:
    #     return "Uolevi"
    # else:
    #     return "Maija"

    arr.sort(reverse=True)
    groups = []
    current_group = [arr[0]]
    
    for pos in arr[1:]:
        if pos == current_group[-1] - 1:
            current_group.append(pos)
        else:
            groups.append(current_group)
            current_group = [pos]
    groups.append(current_group)
    
    xor_sum = 0
    for group in groups:
        xor_sum ^= calculate_recursion(group)
    
    return "Maija" if xor_sum != 0 else "Uolevi"

def calculate_recursion(group):
    if len(group) == 1:
        return group[0]
    return 0 if group[0] == 0 else group[-1] - group[0]

n = int(input())

arr = list(map(int,input().split()))

print(yet_another_game(n,arr))

# Input:
# 3
# 1 2 4
# Output:
# Uolevi
# Example 4
# Input:
# 10
# 0 12 17 18 20 4 5 7 8 11
# Output:
# Maija

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output
Maija

user output
Maija

Test 2

Verdict: ACCEPTED

input
1

correct output
Maija

user output
Maija

Test 3

Verdict:

input
2
3 8 

correct output
Uolevi

user output
Maija

Test 4

Verdict: ACCEPTED

input
2
0 4 

correct output
Maija

user output
Maija

Test 5

Verdict:

input
3
0 7 8 

correct output
Uolevi

user output
Maija

Test 6

Verdict:

input
3
2 8 9 

correct output
Uolevi

user output
Maija

Test 7

Verdict: ACCEPTED

input
3
5 8 9 

correct output
Maija

user output
Maija

Test 8

Verdict: ACCEPTED

input
4
0 3 6 10 

correct output
Maija

user output
Maija

Test 9

Verdict:

input
4
4 6 7 9 

correct output
Uolevi

user output
Maija

Test 10

Verdict:

input
4
2 6 7 9 

correct output
Uolevi

user output
Maija

Test 11

Verdict:

input
4
2 6 7 9 

correct output
Uolevi

user output
Maija

Test 12

Verdict:

input
4
0 3 5 8 

correct output
Uolevi

user output
Maija

Test 13

Verdict: ACCEPTED

input
5
4 5 6 7 9 

correct output
Maija

user output
Maija

Test 14

Verdict:

input
5
0 1 4 7 10 

correct output
Uolevi

user output
Maija

Test 15

Verdict:

input
5
0 2 4 6 10 

correct output
Uolevi

user output
Maija

Test 16

Verdict: ACCEPTED

input
5
0 3 6 7 9 

correct output
Maija

user output
Maija

Test 17

Verdict: ACCEPTED

input
5
1 6 7 9 10 

correct output
Maija

user output
Maija

Test 18

Verdict: ACCEPTED

input
5
0 2 4 9 10 

correct output
Maija

user output
Maija

Test 19

Verdict: ACCEPTED

input
5
0 2 3 9 10 

correct output
Uolevi

user output
Uolevi

Test 20

Verdict: ACCEPTED

input
5
0 2 3 4 8 

correct output
Maija

user output
Maija

Test 21

Verdict: ACCEPTED

input
5
0 2 4 9 10 

correct output
Maija

user output
Maija

Test 22

Verdict: ACCEPTED

input
5
0 1 3 4 5 

correct output
Maija

user output
Maija

Test 23

Verdict: ACCEPTED

input
10
1 6 8 9 11 12 13 15 17 18 

correct output
Maija

user output
Maija

Test 24

Verdict: ACCEPTED

input
10
0 1 2 3 4 6 8 15 19 20 

correct output
Maija

user output
Maija

Test 25

Verdict: ACCEPTED

input
10
0 3 4 6 8 9 10 11 14 19 

correct output
Maija

user output
Maija

Test 26

Verdict: ACCEPTED

input
10
0 1 2 6 9 10 11 14 17 18 

correct output
Maija

user output
Maija

Test 27

Verdict: ACCEPTED

input
10
2 3 4 11 12 14 15 17 18 20 

correct output
Maija

user output
Maija

Test 28

Verdict: ACCEPTED

input
10
1 4 7 8 10 12 17 18 19 20 

correct output
Maija

user output
Maija

Test 29

Verdict: ACCEPTED

input
10
0 1 2 4 6 7 17 18 19 20 

correct output
Maija

user output
Maija

Test 30

Verdict:

input
10
1 4 5 6 9 10 11 15 16 20 

correct output
Uolevi

user output
Maija

Test 31

Verdict: ACCEPTED

input
10
0 4 5 7 8 11 12 17 18 20 

correct output
Maija

user output
Maija

Test 32

Verdict:

input
10
0 1 2 4 5 6 7 8 10 18 

correct output
Uolevi

user output
Maija

Test 33

Verdict: ACCEPTED

input
100
20175392 21709340 41258986 608...

correct output
Maija

user output
Maija

Test 34

Verdict: ACCEPTED

input
100
122815 19636891 20795113 29407...

correct output
Maija

user output
Maija

Test 35

Verdict:

input
100
27838075 70100849 85518673 881...

correct output
Uolevi

user output
Maija

Test 36

Verdict: ACCEPTED

input
100
20130522 22134653 24822300 257...

correct output
Maija

user output
Maija

Test 37

Verdict: ACCEPTED

input
100
5539595 6689687 9648745 204276...

correct output
Maija

user output
Maija

Test 38

Verdict: ACCEPTED

input
100
1763266 2377495 6157974 156559...

correct output
Maija

user output
Maija

Test 39

Verdict:

input
100
44771411 58491553 63972354 689...

correct output
Uolevi

user output
Maija

Test 40

Verdict:

input
100
17083618 26735341 70798610 773...

correct output
Uolevi

user output
Maija

Test 41

Verdict: ACCEPTED

input
100
11934037 12239372 22850647 308...

correct output
Maija

user output
Maija

Test 42

Verdict:

input
100
8099342 11139167 14304400 4141...

correct output
Uolevi

user output
Maija

Test 43

Verdict: ACCEPTED

input
200
5041735 10046682 14572439 2017...

correct output
Maija

user output
Maija

Test 44

Verdict:

input
200
122815 3081987 9672261 1252970...

correct output
Uolevi

user output
Maija

Test 45

Verdict:

input
200
5953276 13977260 27435118 2783...

correct output
Uolevi

user output
Maija

Test 46

Verdict: ACCEPTED

input
200
20130522 22134653 22790965 248...

correct output
Maija

user output
Maija

Test 47

Verdict:

input
200
3142408 5539595 6689687 964874...

correct output
Uolevi

user output
Maija

Test 48

Verdict: ACCEPTED

input
200
1763266 2377495 6157974 132815...

correct output
Maija

user output
Maija

Test 49

Verdict: ACCEPTED

input
200
915343 26318970 39308104 44426...

correct output
Maija

user output
Maija

Test 50

Verdict: ACCEPTED

input
200
1532100 17083618 26735341 4256...

correct output
Maija

user output
Maija

Test 51

Verdict:

input
200
8921055 9526546 11934037 12239...

correct output
Uolevi

user output
Maija

Test 52

Verdict:

input
200
4900392 7823022 8099342 874567...

correct output
Uolevi

user output
Maija

Test 53

Verdict: ACCEPTED

input
1000
59432 2902554 4346620 5041735 ...

correct output
Maija

user output
Maija

Test 54

Verdict:

input
1000
122815 431669 1088001 3081987 ...

correct output
Uolevi

user output
Maija

Test 55

Verdict: ACCEPTED

input
1000
132697 1654352 2021488 2665480...

correct output
Maija

user output
Maija

Test 56

Verdict: ACCEPTED

input
10000
15821 289539 424626 514124 549...

correct output
Maija

user output
Maija

Test 57

Verdict:

input
10000
2993 411720 417065 471376 8375...

correct output
Uolevi

user output
Maija

Test 58

Verdict: ACCEPTED

input
10000
68014 305895 411135 428373 484...

correct output
Maija

user output
Maija

Test 59

Verdict: ACCEPTED

input
100000
7176 18493 20082 35162 36875 4...

correct output
Maija

user output
Maija

Test 60

Verdict: ACCEPTED

input
100000
3073 7000 8135 23450 35708 424...

correct output
Maija

user output
Maija

Test 61

Verdict:

input
100000
1190 7700 13172 20678 24336 30...

correct output
Uolevi

user output
Maija

Test 62

Verdict:

input
100000
6595 11761 30311 52174 56810 6...

correct output
Uolevi

user output
Maija