Code Submission Evaluation System Login

BOI 2016, day 1

Start:2016-05-12 09:00:00
End:2016-05-12 14:00:00
 

Tasks | Scoreboard | Statistics


CSES - BOI 2016, day 1 - Results
History
2016-05-12 11:31:3927
2016-05-12 11:31:2215
2016-05-12 11:30:280
2016-05-12 10:53:4515
Task:Spiral
Sender:Nugusha
Submission time:2016-05-12 11:31:39
Language:C++
Status:READY
Score:27

Feedback

groupverdictscore
#1ACCEPTED12
#2ACCEPTED15
#3WRONG ANSWER0
#4WRONG ANSWER0
#5WRONG ANSWER0

Test results

testverdicttime (s)group
#1ACCEPTED0.31 / 1.501details
#2ACCEPTED0.06 / 1.502details
#3WRONG ANSWER0.05 / 1.503details
#4WRONG ANSWER0.06 / 1.504details
#5WRONG ANSWER0.05 / 1.505details

Compiler report

input/code.cpp:36:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^

Code

// __   _   _   _   _____   _   _   _____   _   _       ___
//|  \ | | | | | | /  ___| | | | | /  ___/ | | | |     /   |
//|   \| | | | | | | |     | | | | | |___  | |_| |    / /| |
//| |\   | | | | | | |  _  | | | | \___  \ |  _  |   / / | |
//| | \  | | |_| | | |_| | | |_| |  ___| | | | | |  / /  | |
//|_|  \_| \_____/ \_____/ \_____/ /_____/ |_| |_| /_/   |_|

#include<bits/stdc++.h>
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define ll long long
#define pii pair< int, int >
#define MEM(p, v) memset(p, v, sizeof(p))
#define READ(f) freopen(f, "r", stdin)
#define R return(0)
#define INF int(1e9)
#define MAX_5 int(1e5+5)
#define MAX_6 int(1e6+6)
#define ll long long
#define tree int h,int l1,int r1
#define left 2*h,l1,(l1+r1)/2
#define right 2*h+1,(l1+r1)/2+1,r1
using namespace std;
      int N=1000;
    int a[2105][2105];
int n,a1,a2,b1,b2;
void pr()
{
	int S=2;
	for(int i=N+S;i>=N-S;i--){
		for(int j=N-S;j<=N+S;j++)
			cout<<a[i][j];cout<<endl;}
}
main()
{
int M=int(1e9+7),q;
      // READ();WRITE();
      
      
      a[N][N]=1;
      int cnt=1;
      int I=0,J=0;
      for(int i=1;i<=1000;i++)
      {
      	I=-(i-1);
      	J=i;
      	
      	
      	for(int j=I;j<=i;j++)
      	{
      		a[j+N][J+N]=++cnt;
      	}    		  
		  
		   
      	for(int j=i-1;j>=-i;j--)
      	{
      		a[i+N][j+N]=++cnt;
      	}     	
      	
      	
      	for(int j=i-1;j>=-i;j--)
      	{
      		a[j+N][-i+N]=++cnt;
      	}
      	
      	
		   
      	for(int j=-i+1;j<=i;j++)
      	{
      		a[-i+N][j+N]=++cnt;
      	}
      }
      
      
     // pr();
      
      
      
      
      
      
      
      
      
      
      
          cin>>n>>q;
          for(int i=1;i<=q;i++)
          {
          	cin>>a1>>b1>>a2>>b2;
          	
          	
          	if(a1==a2 && b1==b2)
          	{
          		
          		long long ans=0;
          		
          		if(a1==0 && b1==0)
          		{
          			cout<<1<<endl;
          			continue;
          		}
          		
          		
          		ll re=max(abs(a1),abs(b1));
          		ll ra=re*2-1;
          		
          	//	cout<<ra<<" "<<re<<endl;
          		
          		ans=ra*ra;
          		
          		
          		
          		
          		if(a1==re)
          		{
          			int qve=-(re-1);
          			ans+=b1-qve+1;
          			ans%=M;
          		}else          		
          		if(b1==re)
          		{
          			int qve=re;
          			ans+=qve-a1+ra+1;
          			ans%=M;
          		}else
          		if(a1==-re)
          		{
          			int ze=re;
          			ans+=ze-b1+ra+ra+2;
          			ans%=M;
          		}else
          		if(b1==-re)
          		{
          			int qve=-re;
          			ans+=a1-qve+ra+ra+ra+3;
          			ans%=M;
          		}
          		
          		cout<<ans<<endl;
          	}else
          	{
          		if(n>1000)cout<<0<<endl;else
          		{
          			swap(a1,b1);
          			swap(a2,b2);
          			long long ans=0;
          			
          			for(int i=a1;i<=a2;i++)
          				for(int j=b1;j<=b2;j++)
          					ans=(ans+a[i+N][j+N])%M;
          					
          			cout<<ans<<endl;
          		}
          	}
          }
          
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1000 100
-709 0 1000 123
-621 -1000 -102 -435
-602 -560 276 -356
-945 -590 0 -468
...
view   save

correct output
788057008
633127082
507903329
53165899
558016315
...
view   save

user output
788057008
633127082
507903329
53165899
558016315
...
view   save

Test 2

Group: 2

Verdict: ACCEPTED

input
1000000000 100
181053719 1000000000 181053719...
view   save

correct output
818946492
750635163
193830026
660632411
46072376
...
view   save

user output
818946492
750635163
193830026
660632411
46072376
...
view   save

Test 3

Group: 3

Verdict: WRONG ANSWER

input
100000 100
-88233 -87279 -49871 52277
-86645 -7997 48948 30702
-79916 -36210 -21257 -16821
0 57331 93163 100000
...
view   save

correct output
986592951
708386765
85336595
18263594
32233727
...
view   save

user output
0
0
0
0
0
...
view   save

Test 4

Group: 4

Verdict: WRONG ANSWER

input
1000000000 100
1 1 21134200 719983102
1 1 929463279 1000000000
1 1 68450838 1
1 1 84417340 297177199
...
view   save

correct output
695961158
957360176
137575768
522232140
58884045
...
view   save

user output
0
0
0
0
0
...
view   save

Test 5

Group: 5

Verdict: WRONG ANSWER

input
1000000000 100
-857489445 -1000000000 -432836...
view   save

correct output
902627632
581519884
819269364
857298983
278402948
...
view   save

user output
0
0
0
0
0
...
view   save