Task: | burek |
Sender: | Kuha |
Submission time: | 2016-08-02 15:35:46 +0300 |
Language: | C++ |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.22 s | details |
#5 | ACCEPTED | 0.32 s | details |
#6 | ACCEPTED | 0.32 s | details |
#7 | ACCEPTED | 0.45 s | details |
#8 | ACCEPTED | 0.45 s | details |
Compiler report
input/code.cpp: In function 'int chx(int, int)': input/code.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ input/code.cpp: In function 'int chy(int, int)': input/code.cpp:23:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^
Code
#include <bits/stdc++.h> #define ll long long #define INF 999999999 #define LINF 999999999999999999LL #define N (1<<20) #define M 1000000007 using namespace std; int vx[2 * N]; int vy[2 * N]; int chx (int k, int n) { k += N; vx[k] += n; for (k /= 2; k >= 1; k /= 2) vx[k] = vx[2 * k] + vx[2 * k + 1]; } int chy (int k, int n) { k += N; vy[k] += n; for (k /= 2; k >= 1; k /= 2) vy[k] = vy[2 * k] + vy[2 * k + 1]; } int gety (int k) { int a = 1; int b = k + N; int s = 0; while (a <= b) { if (a % 2 == 1) s += vy[a++]; if (b % 2 == 0) s += vy[b--]; a /= 2; b /= 2; } return s; } int getx (int k) { int a = 1; int b = k + N; int s = 0; while (a <= b) { if (a % 2 == 1) s += vx[a++]; if (b % 2 == 0) s += vx[b--]; a /= 2; b /= 2; } return s; } int main () { int n; cin>>n; for (int i = 0; i < n; i++) { int x1, y1, x2, y2, x3, y3; cin>>x1>>y1>>x2>>y2>>x3>>y3; int miy = min(min(y1, y2), y3); int may = max(max(y1, y2), y3); int mix = min(min(x1, x2), x3); int mx = max(max(x1, x2), x3); chx(mix + 1, 1); chx(mx, -1); chy(miy + 1, 1); chy(may, -1); } int q; cin>>q; for (int i = 0; i < q; i++) { char c, e; cin>>c>>e; int p; cin>>p; if (c == 'x') cout<<getx(p)<<endl; else cout<<gety(p)<<endl; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3
1 0 0 2 2 2 1 3 3 5 4 0 5 4 4 5 4 4 4 ... |
correct output |
---|
0
1 1 2 |
user output |
---|
0 1 1 2 |
Test 2
Verdict: ACCEPTED
input |
---|
4
2 7 6 0 0 5 7 1 7 10 11 11 5 10 2 9 6 8 1 9 10 10 4 1 ... |
correct output |
---|
3
2 3 2 |
user output |
---|
3 2 3 2 |
Test 3
Verdict: ACCEPTED
input |
---|
10
84 4 53 58 73 85 60 24 59 23 1 11 80 69 61 57 83 91 84 91 3 97 1 94 ... |
correct output |
---|
0
4 1 1 5 ... |
user output |
---|
0 4 1 1 5 ... |
Test 4
Verdict: ACCEPTED
input |
---|
70000
523716 152076 196820 312652 75... |
correct output |
---|
3714
48672 41227 51089 19907 ... |
user output |
---|
3714 48672 41227 51089 19907 ... |
Test 5
Verdict: ACCEPTED
input |
---|
100000
554 492 443 655 24 170 867 578 502 743 73 276 738 487 297 633 494 469 753 268 131 447 924 530 ... |
correct output |
---|
73985
28536 71335 58180 74422 ... |
user output |
---|
73985 28536 71335 58180 74422 ... |
Test 6
Verdict: ACCEPTED
input |
---|
99999
556 490 167 620 238 60 214 608 982 363 975 378 557 111 872 233 227 61 58 477 37 808 578 225 ... |
correct output |
---|
57947
50886 46878 70092 16298 ... |
user output |
---|
57947 50886 46878 70092 16298 ... |
Test 7
Verdict: ACCEPTED
input |
---|
99999
521698 336192 884832 495601 73... |
correct output |
---|
2710
18050 45557 42424 4570 ... |
user output |
---|
2710 18050 45557 42424 4570 ... |
Test 8
Verdict: ACCEPTED
input |
---|
100000
702229 435001 483066 464189 74... |
correct output |
---|
66201
69812 28734 33874 14815 ... |
user output |
---|
66201 69812 28734 33874 14815 ... |