Submission #68926

# Submission time Handle Problem Language Result Execution time Memory
68926 2018-08-19T09:19:44 Z alenam0161 Spiral (BOI16_spiral) C++17
0 / 100
3 ms 484 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 5007;

int main()
{
	int n,q;
	cin>>n>>q;
	for(int i=1;i<=q;++i){
		int x,y;
		cin>>x>>y>>x>>y;
		int r=max(abs(x),abs(y));
		long long sz=(r+r+1)*1ll*(r+r+1);
		if(y==-r){
			cout<<sz-(r-x)<<endl;
		}
		else{
			sz-=r;
			sz-=r;
			if(x==-r){
				cout<<sz-(y+r)<<endl;
			}
			else{
				sz-=r;
				sz-=r;
				if(y==r){
					cout<<sz-(x+r)<<endl;
				}
				else{
					sz-=r;
					sz-=r;
					cout<<sz-(r-y)<<endl;
				}
			}
		}
	}
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 484 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct