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 13:58:350
2016-05-12 13:52:500
2016-05-12 13:49:410
2016-05-12 13:47:180
2016-05-12 13:42:130
Task:Spiral
Sender:markuskl
Submission time:2016-05-12 13:58:35
Language:Java
Status:READY
Score:0

Feedback

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

Test results

testverdicttime (s)group
#1WRONG ANSWER0.10 / 1.501details
#2WRONG ANSWER0.11 / 1.502details
#3WRONG ANSWER0.10 / 1.503details
#4WRONG ANSWER0.11 / 1.504details
#5WRONG ANSWER0.10 / 1.505details

Code

import java.util.Scanner;

public class Spiral {

	public static void main(String[] args) {
		IO io = new IO();
//		Scanner io = new Scanner(System.in);
		
		io.nextLong();
		int Q = io.nextInt();
		for(int i = 0; i<Q; i++){
			io.println(cord(io.nextLong(),io.nextLong()));
			io.nextLong();
			io.nextLong();
		}
		io.close();
	}
	
	static long cord(long x, long y){
		if(x == 0 && y == 0)
			return 1;
		long inside = (Math.max(Math.abs(x)-1, Math.abs(y)-1));
		long in2 = (long) (Math.pow(inside*2+1, 2) % 1000000007);
		long max = inside+1;
		
		if(y == max){
			return ((in2+inside*2+2+y-x) % 1000000007);
		}
		else if(-1*y == max){
			return ((in2+inside*6+6-y+x) % 1000000007);
		}
		else if(-1*x == max){
			return ((in2+inside*4+4-x-y) % 1000000007);
		}
		else {
			return ((in2+x+y) % 1000000007);
		}
		
	}

}

Test details

Test 1

Group: 1

Verdict: WRONG ANSWER

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
2011434
4002380
1450779
3573636
2620246
...
view   save

Test 2

Group: 2

Verdict: WRONG ANSWER

input
1000000000 100
181053719 1000000000 181053719...
view   save

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

user output
818946491
750635154
193829969
660632330
46072351
...
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
140424452
29518533
546384176
147316823
919645860
...
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
3
3
3
3
3
...
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
142510737
147813712
117283027
17826687
623833073
...
view   save