# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
968079 |
2024-04-23T07:34:50 Z |
PM1 |
Spiral (BOI16_spiral) |
C++17 |
|
1 ms |
448 KB |
#include <bits/stdc++.h>
using namespace std;
const int mxn=1e9+5,M=1e9+7;
int n,q;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>q;
while(q--){
int x,y,xx,yy;
cin>>y>>x>>yy>>xx;
int w=max(abs(x),abs(y));
int z=w*2+1,zz=z*z;
if(-w==x){
cout<<zz-(w-y)<<'\n';
continue;
}
zz-=z-1;
if(-w==y){
cout<<zz-(x+w-1)<<'\n';
continue;
}
zz-=z-1;
if(x==w){
cout<<zz-(x+w-1)<<'\n';
continue;
}
zz-=z-1;
cout<<zz-(w-1-x)<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |