Submission #926992

#TimeUsernameProblemLanguageResultExecution timeMemory
926992irmuunSpiral (BOI16_spiral)C++17
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,q; cin>>n>>q; while(q--){ ll x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; ll mx=max(abs(x1),abs(y1)); if(mx==0){ cout<<1<<"\n"; continue; } ll x=(mx*2+1)*(mx*2+1),ans; if(y1==-mx){ ans=x-(mx-x1); } else if(x1==-mx){ ans=x-2*mx-(y1-mx); } else if(y1==mx){ ans=x-4*mx-(x1+mx); } else{ ans=x-6*mx-(mx-y1); } const ll mod=1e9+7; cout<<ans%mod<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...