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:410
2016-05-12 13:54:500
2016-05-12 13:48:180
2016-05-12 13:45:040
Task:Spiral
Sender:VladaMG98
Submission time:2016-05-12 13:58:41
Language:C++
Status:READY
Score:0

Feedback

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

Test results

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

Compiler report

input/code.cpp: In function 'long long int get(long long int, long long int)':
input/code.cpp:29:19: warning: unused variable 'dr' [-Wunused-variable]
         long long dr=fdr(where)%MOD;
                   ^
input/code.cpp: In function 'int main()':
input/code.cpp:41:24: 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:53:46: 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);
                                              ^
input/code.cpp:61:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld%lld",&x1,&y1,&x2,&y2);
                                                  ^

Code

#include <bits/stdc++.h>
using namespace std;
const long long MOD=1000*1000*1000+7;
const int MAXN=1010;
long long mat[2*MAXN][2*MAXN];
long long sums[2*MAXN][2*MAXN];
long long fur(long long x)
{
    return 4ll*x*x-10ll*x+7ll;
}
long long ful(long long x)
{
    return 4ll*x*x+1ll;
}
long long fdr(long long x)
{
    return 4ll*x*x+4ll*x+1ll;
}
long long fdl(long long x)
{
    return 4ll*x*x-6ll*x+3ll;
}
long long get(long long x,long long y)
{
        if(x==0&&y==0) return 1ll;
        long long where=max(abs(x),abs(y));
        long long ur=fur(where+1)%MOD;
        long long ul=ful(where)%MOD;
        long long dr=fdr(where)%MOD;
        long long dl=fdl(where+1)%MOD;
        //printf("%lld %lld %lld %lld\n",ur,ul,dl,dr);
        if(y==where) return (ul-(x+where)+MOD*MOD)%MOD;
        if(y==-where) return (dl+(x+where)+MOD*MOD)%MOD;
        if(x==where) return (ur-(y+where)+MOD*MOD)%MOD;
        if(x==-where) return (ul+(y+where)+MOD*MOD)%MOD;
        assert(false);
}
int main()
{
    int n,q;
    scanf("%d%d",&n,&q);
    if(n<=1000)
    {
        for(int i=1;i<=2*n+1;i++)
            for(int j=1;j<=2*n+1;j++)
                mat[i][j]=get(i-n-1,j-n-1)%MOD;
        for(int i=1;i<=2*n+1;i++)
            for(int j=1;j<=2*n+1;j++)
                sums[i][j]=(sums[i-1][j]+sums[i][j-1]-sums[i-1][j-1]+mat[i][j]+MOD)%MOD;
        while(q--)
        {
            int x1,x2,y1,y2;
            scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
            printf("%lld\n",(sums[x2+n+1][y2+n+1]-sums[x1+n][y2+n+1]-sums[x2+n+1][y1+n]+sums[x1+n][y1+n]+MOD*MOD)%MOD);
        }
        return 0;
    }
    while(q--)
    {
        long long x1,y1,x2,y2;
        scanf("%lld%lld%lld%lld",&x1,&y1,&x2,&y2);
        printf("%lld\n",get(x1,y1));
    }
}

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
783618676
615852022
482298829
999340286
558016315
...
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
818946492
750635163
193830026
942605285
46072378
...
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
140249894
29502539
546311756
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
142510738
147813673
117282934
17826800
623833082
...
view   save