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:59:430
Task:Spiral
Sender:max.red
Submission time:2016-05-12 13:59:43
Language:C++
Status:READY
Score:0

Feedback

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

Test results

testverdicttime (s)group
#1WRONG ANSWER0.21 / 1.501details
#2RUNTIME ERROR0.15 / 1.502details
#3RUNTIME ERROR0.15 / 1.503details
#4RUNTIME ERROR0.18 / 1.504details
#5RUNTIME ERROR0.14 / 1.505details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:36:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &q);
                         ^
input/code.cpp:54:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
                                             ^

Code

#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < (int) (n); i++)
#define x1 qweopiwqeowqie
#define x2 qweopwetwetie
#define y1 qweopwtewtwetqie
#define y2 qrtyrtytrytrie
const int N = 1000000;
const int M = 2500;
const int mid = M / 2;
const int mod = 1e9 + 7;

int n, q, x1, x2, y1, y2, A[M][M], t, ans;
int dr[4] = {0, -1, 0, 1};
int dc[4] = {1, 0, -1, 0};
vector<int> V;

void recorrer(int x, int y, int p){
  if(p == 100) return;
  //printf("ok %d %d %d\n", x, y, p);
  int r = p % 4;
  x += dr[r];
  y += dc[r];
  A[x][y] = ++t;
  
  forn(i, V[p] - 1){
    x += dr[r];
    y += dc[r];
    A[x][y] = ++t;
  }
  
  recorrer(x, y, p + 1);
}

int main(){
  scanf("%d %d", &n, &q);
  
  forn(i, N){
    V.push_back(i + 1);
    V.push_back(i + 1);
  }
  
  A[mid][mid] = ++t;
  recorrer(mid, mid, 0);
  
  /*for(int i = mid - 3; i < M / 2 + 3; i++){
    for(int j = mid - 3; j < M / 2 + 3; j++){
      printf("%d ", A[i][j]);
    }
    puts("");
  }*/
  
  while(q--){
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    x1 += mid;
    x2 += mid;
    y1 += mid;
    y2 += mid;
    ans = 0;
    swap(x1, y1);
    swap(x2, y2);
    if(x1 > x2) swap(x1, x2);
    if(y1 > y2) swap(y1, y2);
    for(int i = x1; i <= x2; i++){
      for(int j = y1; j <= y2; j++){
        ans += A[i][j];
        ans %= mod;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

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
1607676
0
0
0
0
...
view   save

Test 2

Group: 2

Verdict: RUNTIME ERROR

input
1000000000 100
181053719 1000000000 181053719...
view   save

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

user output
(empty)

Test 3

Group: 3

Verdict: RUNTIME ERROR

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
(empty)

Test 4

Group: 4

Verdict: RUNTIME ERROR

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
(empty)

Test 5

Group: 5

Verdict: RUNTIME ERROR

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

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

user output
(empty)