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