#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 5007;
int main()
{
int n,q;
cin>>n>>q;
for(int i=1;i<=q;++i){
int x,y;
cin>>x>>y>>x>>y;
int r=max(abs(x),abs(y));
long long sz=(r+r+1)*1ll*(r+r+1);
if(y==-r){
cout<<sz-(r-x)<<endl;
}
else{
sz-=r;
sz-=r;
if(x==-r){
cout<<sz-(y+r)<<endl;
}
else{
sz-=r;
sz-=r;
if(y==r){
cout<<sz-(x+r)<<endl;
}
else{
sz-=r;
sz-=r;
cout<<sz-(r-y)<<endl;
}
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
484 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
484 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |