제출 #764420

#제출 시각아이디문제언어결과실행 시간메모리
764420EllinorSpiral (BOI16_spiral)C++14
15 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i < (b); i++) typedef long long ll; int N,q; int32_t main() { cin>>N>>q; // int x1, y1, x2, y2; ll mod = 1e9 + 7; rep(i,0,q) { cin>>x1>>y1>>x2>>y2; // if(N<=1000) // { // // // } if(x1==x2 && y1==y2) { ll circle = max(abs(x1),abs(y1)); ll root = circle*2; root++; ll square = root*root; ll ans; if(y1==(-circle)){ ll diff = circle - x1; ans = square - diff; } else if(x1==(-circle)){ ll diff = circle + y1; diff += circle; diff += circle; ans = square - diff; } else if(y1==circle){ ll diff = circle*4; diff += circle + x1; ans = square - diff; } else{ ll diff = circle*6; diff += (circle - y1); ans = square - diff; } ans = ans % mod; cout<<ans<<"\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...