#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;
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;
}
cout<<ans<<"\n";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |