| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 68930 | alenam0161 | Spiral (BOI16_spiral) | C++17 | 4 ms | 488 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 h=r+r+1;
h%=mod;
long long sz=h*h;
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 |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
