CSES - Datatähti 2022 alku - Results
Submission details
Task:Spiraali
Sender:WalkStalker
Submission time:2021-10-06 12:05:31 +0300
Language:Pascal
Status:READY
Result:15
Feedback
groupverdictscore
#1ACCEPTED15
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1details
#20.01 s2details
#30.01 s3details

Compiler report

/usr/bin/ld.bfd: warning: output/link.res contains output sections; did you forget -T?

Code

program abc;
var
  n,t,x,y,p,i,net,am:integer;
  resultat: array [0..1000] of integer;
 begin
   readln (n,t);
  
  repeat 
   readln (x,y);
   x:=2*(x-1)-n+1;
y:=2*(y-1)-n+1;

if abs(x)>=abs(y) then
  net:=abs(x) else
    net:=abs(y);
  
  p:=(x+y)div 2;

  
  if (x < y) then
        p:=2*net-p;

 resultat[am]:=n*n-net*net-net+p;
 
 
 
    am:=am+1;
    until am=t;
    for i:=0 to t-1 do
      writeln (resultat[i]);
   
 end. 

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
...

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
-12899
-15514
9445
3472
4098
...

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
-20478
8745
-20392
13578
15921
...