CSES - Datatähti 2022 alku - Results
Submission details
Task:Spiraali
Sender:severi
Submission time:2021-10-17 13:01:42 +0300
Language:Python3 (PyPy3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.07 s1details
#20.08 s2details
#30.08 s3details

Code

njat = input().split(" ")
n = int(njat[0])
t = int(njat[1])




i = 0

kordinaatit = []

while i < t:
    kordinaatit.append(input())
    i += 1

layers = round(n / 2 + 0.1)
i = 0
ruudukko = n * n

while i < t:
    y = int(kordinaatit[i][0])
    x = int(kordinaatit[i][2])
    k = n + 1 - x
    s = n + 1 - y
    layer = x
    i += 1
    if y < x:
        layer = y
    if s < layer:
        layer = s
    if k < layer:
        layer = k

    inner = n - (2 * (layer - 1))
    ekaruutu = ruudukko - inner * inner + 1
    if x == layer:
        vastaus = y - layer + ekaruutu
    elif s == layer:
        vastaus = x - layer + ekaruutu + inner - 1
    elif y == layer:
        vastaus = ekaruutu + inner + inner + inner - 3 + k - layer
    else:
        vastaus = ekaruutu + inner + inner - 2 + s - layer
    print(vastaus)


Test details

Test 1

Group: 1

Verdict:

input
10 100
1 1
1 2
1 3
1 4
...

correct output
1
36
35
34
33
...

user output
1
36
35
34
33
...
Truncated

Error:
Traceback (most recent call last):
  File "input/code.py", line 22, in <module>
    x = in...

Test 2

Group: 2

Verdict:

input
1000 1000
371 263
915 322
946 880
53 738
...

correct output
773533
312166
206053
200080
593922
...

user output
3
15941
19904

Error:
Traceback (most recent call last):
  File "input/code.py", line 22, in <module>
    x = in...

Test 3

Group: 3

Verdict:

input
1000000000 1000
177757853 827347032
409613589 419171337
739269360 256524697
328695530 896842209
...

correct output
571375684522141210
967321186816598569
762879105851175000
370065046779516790
936897883750373771
...

user output
3999999991
15999999932
27999999803
11999999960
11999999964
...
Truncated