Task: | Spiraali |
Sender: | Nikedi |
Submission time: | 2021-10-08 18:15:55 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1 | details |
#2 | WRONG ANSWER | 0.40 s | 2 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:18:25: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if(x=1){ ~^~
Code
#include <iostream> #include <cmath> using namespace std; int main(){ long long n; long long t; long long x; long long y; cin >> n >> t; for(long long i=0;i<t;i++){ cin >> x >> y; long long sum=0; for(long long u=0;u<t;u++){ if(y>=x){//vasen ala 1/2 if(x+y<=10){//vasen 1/4 if(x=1){ cout << y << "\n"; }else{ for(long long k=1;k<=2*x-2;k++){ sum += 2*(n-k); } cout << n+sum-(n-4)+(x+1) << "\n"; sum=0; } }else{//ala 1/4 if(y==n){ cout << n+x-1 << "\n"; }else{ for(long long k=1;k<=2*(n-y);k++){ sum += 2*(n-k); } cout << n+sum-(n-y)+(x-1) << "\n"; sum=0; } } }else{//oike ylä 1/2 if(x+y<10){//ylä 1/4 for(long long k=1;k<=2*y-1;k++){ sum += 2*(n-k); } cout << n+sum+(n-x)-(y-1) << "\n"; sum=0; }else{//oikea 1/4 for(long long k=1;k<=2*(n-x)+1;k++){ sum += 2*(n-k); } cout << n+sum-(n-x+1)-y << "\n"; sum=0; } } } } } /* jos y>=x niin vihreä: jos x+y<=10 niin vasen 1/4: jos x=1: cout << y; muuten: n+sum(2(n-i);1;2*x-2)-(n-4)+(x-1) muuten, eli ala 1/4: jos y=n: cout << n+x-1; muuten: n+sum(2(n-i);1;2*(n-y))-(n-y)+(x-1) jos y<x niin punainen: jos x+y<10 niin ruskea: n+sum(2(n-i);1;2*y-1)+(n-x)-(y-1) muuten, eli oike 1/4: n+sum(2(n-i);1;2(n-x)+1)-(n-x+1)-y r = 4*rivi Rivi 1: 1,r(n-1),r(n-1)-1,...,rn-n-2 Rivi 2: ?,?,r(n-2),r(n-2)-1,...,r(n-2)-,? Vika rivi: n,n+1,...n,2n-1 n+2(n-1)+2(n-2)+...+2 3 loop f(x,y)= n+sum(2(n-i);1;3) ^tossa poikkoilee silleen 6 16 24 30 34 36 1,6 6,1 2,5 5,2 3,4 4,3 * * * 0 1 2 3 4 5 eli diagonaalisesti vasen ala oikee ylä kun max on parillinen niin vasen ala kun pariton niin oikea ylä n+sum(2(n-i);1;x) vihreä vasen ala 1/2 punainen oikea ylä 1/2 ruskea ylä 1/4 */
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
10 100 1 1 1 2 1 3 1 4 ... |
correct output |
---|
1 36 35 34 33 ... |
user output |
---|
1 1 1 1 1 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 371 263 915 322 946 880 53 738 ... |
correct output |
---|
773533 312166 206053 200080 593922 ... |
user output |
---|
931767 931767 931767 931767 931767 ... 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) |