CSES - E4590 2016 5 - Results
Submission details
Task:Kayaks
Sender:dani28
Submission time:2016-10-15 16:26:51 +0300
Language:Python3
Status:READY
Result:
Test results
testverdicttime
#10.06 sdetails
#20.05 sdetails
#30.07 sdetails
#40.06 sdetails
#50.07 sdetails
#60.07 sdetails
#70.08 sdetails
#80.07 sdetails
#90.07 sdetails
#100.08 sdetails
#110.09 sdetails
#120.07 sdetails

Code

import sys
def is_number(s):
    try:
        float(s)
        return True
    except ValueError:
        return False
first_line = (sys.stdin.readline()).split()
num1 = int(first_line[0])
num2 = int(first_line[1])
i=0
l = [0] * num1
while i<num1:
    s = list(sys.stdin.readline())
    del(s[-1])
    del(s[-1])
    j=0
    while j<len(s):
        if(is_number(s[j])):
            detect_num = int(s[j])
            dots = len(s[j+2:])
            l[detect_num-1] = dots+1
        j=j+1
    i=i+1
    print(l)
backup = l
l.sort()
new_l = set(l)
new_l = list(new_l)
print(new_l)

j=0
rank = []
while j<len(backup):
    r = new_l.index(backup[j])
    rank.append(r+1)
    j=j+1
print("\n".join(map(str, rank)))
    


             
            
    


Test details

Test 1

Verdict:

input
10 15
S..........222F
S.....111.....F
S...333.......F
S...555.......F
...

correct output
5
1
6
3
6
...

user output
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
[6, 1, 0, 0, 0, 0, 0, 0, 0, 0]
[6, 1, 8, 0, 0, 0, 0, 0, 0, 0]
[6, 1, 8, 0, 8, 0, 0, 0, 0, 0]
[6, 1, 8, 4, 8, 0, 0, 0, 0, 0]
...

Test 2

Verdict:

input
10 10
S.....111F
S....222.F
S...333..F
S..444...F
...

correct output
1
2
3
4
5
...

user output
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 0, 0, 0, 0, 0]
...

Test 3

Verdict:

input
10 10
S...111..F
S....222.F
S.....333F
S444.....F
...

correct output
3
2
1
6
5
...

user output
[3, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[3, 2, 0, 0, 0, 0, 0, 0, 0, 0]
[3, 2, 1, 0, 0, 0, 0, 0, 0, 0]
[3, 2, 1, 6, 0, 0, 0, 0, 0, 0]
[3, 2, 1, 6, 5, 0, 0, 0, 0, 0]
...

Test 4

Verdict:

input
10 20
S..................F
S...111............F
S......222.........F
S.........333......F
...

correct output
9
7
5
3
1
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[13, 0, 0, 0, 0, 0, 0, 0, 0, 0...

Test 5

Verdict:

input
20 20
S999...............F
S..................F
S..................F
S..................F
...

correct output
5
3
7
6
4
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 16, 0...

Test 6

Verdict:

input
30 30
S............................F...

correct output
1
6
5
4
3
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...

Test 7

Verdict:

input
30 30
S111.........................F...

correct output
1
1
1
1
1
...

user output
[26, 0, 0, 0, 0, 0, 0, 0, 0, 0...

Test 8

Verdict:

input
30 30
S111.........................F...

correct output
7
6
5
3
2
...

user output
[26, 0, 0, 0, 0, 0, 0, 0, 0, 0...

Test 9

Verdict:

input
30 30
S............................F...

correct output
1
1
1
1
3
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...

Test 10

Verdict:

input
30 30
S............................F...

correct output
5
3
3
3
1
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...

Test 11

Verdict:

input
30 30
S............................F...

correct output
6
5
3
5
4
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...

Test 12

Verdict:

input
30 30
S............................F...

correct output
5
4
3
1
2
...

user output
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...