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:08:5515
2016-05-12 13:08:330
2016-05-12 11:10:5615
2016-05-12 10:46:480
2016-05-12 10:38:310
2016-05-12 10:33:180
2016-05-12 10:10:160
Task:Spiral
Sender:profMagija
Submission time:2016-05-12 13:08:55
Language:C++
Status:READY
Score:15

Feedback

groupverdictscore
#1WRONG ANSWER0
#2ACCEPTED15
#3WRONG ANSWER0
#4TIME LIMIT EXCEEDED0
#5WRONG ANSWER0

Test results

testverdicttime (s)group
#1WRONG ANSWER0.05 / 1.501details
#2ACCEPTED0.05 / 1.502details
#3WRONG ANSWER0.05 / 1.503details
#4TIME LIMIT EXCEEDED-- / 1.504details
#5WRONG ANSWER0.05 / 1.505details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:36:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i %i", &N, &Q);
                           ^
input/code.cpp:40:49: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i %i %i %i", &x1, &y1, &x2, &y2);
                                                 ^

Code

#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>

#define dbg(x)

const int mod = 1000000007;

int modpol(int a, int b, int c, int x)
{
    long long z = (long long)a * x + b;
    z %= mod;
    z = z * x + c;
    z %= mod;
    return z;
}

int get(int x, int y)
{
    if (x > y)
    {
        if (x > -y)
            return modpol(4,-3,1+y,x);
        return modpol(4,-3,1+x,y);
    }
    if (x > -y)
        return modpol(4,-1,1-x,y);
    return modpol(4,-1,1-y,x);
}


int main()
{
    int N,Q;
    scanf("%i %i", &N, &Q);
    for (int i = 0; i < Q; i++)
    {
        int x1,y1,x2,y2;
        scanf("%i %i %i %i", &x1, &y1, &x2, &y2);
        if (x1 == x2 && y1 == y2)
            printf("%d\n", (get(x1,y1)%mod + mod) % mod);
        else if (x1 == 1 && y1 == 1)
        {
            int sum = 0;
            for (int i = 2; i <= x2; i++)
            {
                int d = std::min(y2, i-1);
                sum += d * get(i,0) % mod + (d) * (d+1) / 2;
                sum %= mod;
                dbg(printf("x %i %i\n", i, d));
            }

            for (int i = 1; i <= y2; i++)
            {
                int d = std::min(x2, i);
                sum += d * get(0,i) % mod - d * (d+1) / 2;
                sum %= mod;
                dbg(printf("y %i %i\n", i, d));
            }
            printf("%d\n", (sum+mod)%mod);
        }
        else
        {
            printf("ne znam\n");
        }
    }

    /*for (int y = 5; y > -6; y--)
    {
        for (int x = -5; x < 6; ++x)
        {
            printf("%5i", (get(x,y)%mod + mod) % mod);
        }
        printf("\n");
    }*/
}

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
ne znam
ne znam
ne znam
ne znam
ne znam
...
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
ne znam
ne znam
ne znam
ne znam
ne znam
...
view   save

Test 4

Group: 4

Verdict: TIME LIMIT EXCEEDED

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: WRONG ANSWER

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

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

user output
ne znam
ne znam
ne znam
ne znam
ne znam
...
view   save