Submission #226272

# Submission time Handle Problem Language Result Execution time Memory
226272 2020-04-23T09:10:35 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
100 / 100
2627 ms 3960 KB
#include <bits/stdc++.h>
typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}

Compilation message

dragon2.cpp:2:138: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}
                                                                                                                                          ^
dragon2.cpp: In function 'int main()':
dragon2.cpp:2:159: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}
                                                                                                                                                          ~~~~~^~~~~~~~~~~~~~~
dragon2.cpp:2:191: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}
                                                                                                                                                                                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:2:245: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}
                                                                                                                                                                                                                                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:2:312: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;struct P{ll x,y;}A,B;bool C(P X,P Y,P Z){return(X.x-Y.x)*(Z.y-Y.y)<(X.y-Y.y)*(Z.x-Y.x);}std::vector<P>T[30001];main(){int n,m,q,x,y;scanf("%d %d",&n,&m);while(n--){scanf("%lld %lld %d",&A.x,&A.y,&q);T[q].push_back(A);}scanf("%lld %lld %lld %lld\n%d",&A.x,&A.y,&B.x,&B.y,&q);while(q--){scanf("%d %d",&x,&y);m=0;for(P i:T[x])for(P j:T[y]){if(C(i,A,B))m+=(C(i,A,j)&C(j,B,i));else m+=(C(j,A,i)&C(i,B,j));}printf("%d\n",m);}}
                                                                                                                                                                                                                                                                                                                   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1152 KB Output is correct
2 Correct 17 ms 1152 KB Output is correct
3 Correct 22 ms 1152 KB Output is correct
4 Correct 50 ms 2172 KB Output is correct
5 Correct 46 ms 2296 KB Output is correct
6 Correct 8 ms 1152 KB Output is correct
7 Correct 7 ms 1152 KB Output is correct
8 Correct 12 ms 1152 KB Output is correct
9 Correct 12 ms 1152 KB Output is correct
10 Correct 11 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 567 ms 2380 KB Output is correct
2 Correct 1118 ms 2428 KB Output is correct
3 Correct 44 ms 2560 KB Output is correct
4 Correct 21 ms 2560 KB Output is correct
5 Correct 25 ms 2688 KB Output is correct
6 Correct 563 ms 2548 KB Output is correct
7 Correct 570 ms 2428 KB Output is correct
8 Correct 565 ms 2548 KB Output is correct
9 Correct 572 ms 2200 KB Output is correct
10 Correct 565 ms 2172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1152 KB Output is correct
2 Correct 17 ms 1152 KB Output is correct
3 Correct 22 ms 1152 KB Output is correct
4 Correct 50 ms 2172 KB Output is correct
5 Correct 46 ms 2296 KB Output is correct
6 Correct 8 ms 1152 KB Output is correct
7 Correct 7 ms 1152 KB Output is correct
8 Correct 12 ms 1152 KB Output is correct
9 Correct 12 ms 1152 KB Output is correct
10 Correct 11 ms 1152 KB Output is correct
11 Correct 567 ms 2380 KB Output is correct
12 Correct 1118 ms 2428 KB Output is correct
13 Correct 44 ms 2560 KB Output is correct
14 Correct 21 ms 2560 KB Output is correct
15 Correct 25 ms 2688 KB Output is correct
16 Correct 563 ms 2548 KB Output is correct
17 Correct 570 ms 2428 KB Output is correct
18 Correct 565 ms 2548 KB Output is correct
19 Correct 572 ms 2200 KB Output is correct
20 Correct 565 ms 2172 KB Output is correct
21 Correct 560 ms 2552 KB Output is correct
22 Correct 1109 ms 2432 KB Output is correct
23 Correct 1120 ms 2808 KB Output is correct
24 Correct 324 ms 3832 KB Output is correct
25 Correct 72 ms 3704 KB Output is correct
26 Correct 70 ms 3832 KB Output is correct
27 Correct 28 ms 2944 KB Output is correct
28 Correct 28 ms 2944 KB Output is correct
29 Correct 2627 ms 3712 KB Output is correct
30 Correct 89 ms 3444 KB Output is correct
31 Correct 65 ms 3700 KB Output is correct
32 Correct 81 ms 3704 KB Output is correct
33 Correct 380 ms 3884 KB Output is correct
34 Correct 65 ms 3960 KB Output is correct
35 Correct 64 ms 3704 KB Output is correct
36 Correct 64 ms 3704 KB Output is correct
37 Correct 67 ms 3832 KB Output is correct
38 Correct 609 ms 3704 KB Output is correct
39 Correct 508 ms 3704 KB Output is correct
40 Correct 376 ms 3832 KB Output is correct
41 Correct 1808 ms 3704 KB Output is correct
42 Correct 1090 ms 3832 KB Output is correct
43 Correct 875 ms 3704 KB Output is correct
44 Correct 1572 ms 2932 KB Output is correct
45 Correct 774 ms 2696 KB Output is correct
46 Correct 495 ms 2832 KB Output is correct
47 Correct 572 ms 2544 KB Output is correct
48 Correct 306 ms 2552 KB Output is correct
49 Correct 207 ms 2680 KB Output is correct