Task: | Spiraali |
Sender: | Erikoisjaakari |
Submission time: | 2021-10-06 18:25:54 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | 35 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 15 |
#2 | ACCEPTED | 20 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.14 s | 2 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
Q=' ' P=input N=range L='w' K='p' J='e' I=int G='s' F=P().split(Q) D=I(F[0]) O=I(F[1]) E=[] for R in N(D): M=[] for S in N(D):M.append(0) E.append(M) H=1 A=0 B=0 C=G while H<=D*D: E[A][B]=H if(A,B)==(D-1,0)or(A,B)==(D-1,D-1)or(A,B)==(0,D-1): if C==G:C=J elif C==J:C=K elif C==K:C=L elif C==L:C=G if C==G: A+=1 if E[A][B]!=0:C=J;B+=1;A-=1 elif C==J: B+=1 if E[A][B]!=0:C=K;B-=1;A-=1 elif C==K: A-=1 if E[A][B]!=0:C=L;A+=1;B-=1 elif C==L: B-=1 if E[A][B]!=0:C=G;B+=1;A+=1 H+=1 for T in N(O):F=P().split(Q);A=I(F[0])-1;B=I(F[1])-1;print(E[A][B])
Test details
Test 1
Group: 1
Verdict: ACCEPTED
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 |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
1000 1000 371 263 915 322 946 880 53 738 ... |
correct output |
---|
773533 312166 206053 200080 593922 ... |
user output |
---|
773533 312166 206053 200080 593922 ... Truncated |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000000 1000 177757853 827347032 409613589 419171337 739269360 256524697 328695530 896842209 ... |
correct output |
---|
571375684522141210 967321186816598569 762879105851175000 370065046779516790 936897883750373771 ... |
user output |
---|
(empty) |