답안 #226270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
226270 2020-04-23T09:09:09 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
100 / 100
2623 ms 2424 KB
#include <bits/stdc++.h>
typedef long long ll;using namespace std;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);}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);}return 0;}

Compilation message

dragon2.cpp:2:153: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 typedef long long ll;using namespace std;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);}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);}return 0;}
                                                                                                                                                         ^
dragon2.cpp: In function 'int main()':
dragon2.cpp:2:174: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;using namespace std;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);}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);}return 0;}
                                                                                                                                                                         ~~~~~^~~~~~~~~~~~~~~
dragon2.cpp:2:206: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;using namespace std;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);}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);}return 0;}
                                                                                                                                                                                                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:2:260: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;using namespace std;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);}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);}return 0;}
                                                                                                                                                                                                                                                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:2:327: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 typedef long long ll;using namespace std;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);}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);}return 0;}
                                                                                                                                                                                                                                                                                                                                  ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1108 KB Output is correct
2 Correct 17 ms 1152 KB Output is correct
3 Correct 23 ms 1152 KB Output is correct
4 Correct 50 ms 1656 KB Output is correct
5 Correct 46 ms 1528 KB Output is correct
6 Correct 7 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 13 ms 1152 KB Output is correct
10 Correct 12 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 558 ms 1844 KB Output is correct
2 Correct 1115 ms 1812 KB Output is correct
3 Correct 44 ms 1920 KB Output is correct
4 Correct 22 ms 1920 KB Output is correct
5 Correct 24 ms 1920 KB Output is correct
6 Correct 566 ms 1908 KB Output is correct
7 Correct 564 ms 1908 KB Output is correct
8 Correct 566 ms 1908 KB Output is correct
9 Correct 588 ms 1788 KB Output is correct
10 Correct 557 ms 1788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1108 KB Output is correct
2 Correct 17 ms 1152 KB Output is correct
3 Correct 23 ms 1152 KB Output is correct
4 Correct 50 ms 1656 KB Output is correct
5 Correct 46 ms 1528 KB Output is correct
6 Correct 7 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 13 ms 1152 KB Output is correct
10 Correct 12 ms 1152 KB Output is correct
11 Correct 558 ms 1844 KB Output is correct
12 Correct 1115 ms 1812 KB Output is correct
13 Correct 44 ms 1920 KB Output is correct
14 Correct 22 ms 1920 KB Output is correct
15 Correct 24 ms 1920 KB Output is correct
16 Correct 566 ms 1908 KB Output is correct
17 Correct 564 ms 1908 KB Output is correct
18 Correct 566 ms 1908 KB Output is correct
19 Correct 588 ms 1788 KB Output is correct
20 Correct 557 ms 1788 KB Output is correct
21 Correct 554 ms 1788 KB Output is correct
22 Correct 1130 ms 1888 KB Output is correct
23 Correct 1128 ms 2048 KB Output is correct
24 Correct 320 ms 2424 KB Output is correct
25 Correct 71 ms 2168 KB Output is correct
26 Correct 68 ms 2168 KB Output is correct
27 Correct 29 ms 2176 KB Output is correct
28 Correct 28 ms 2168 KB Output is correct
29 Correct 2623 ms 2304 KB Output is correct
30 Correct 93 ms 2164 KB Output is correct
31 Correct 65 ms 2036 KB Output is correct
32 Correct 82 ms 2296 KB Output is correct
33 Correct 378 ms 2424 KB Output is correct
34 Correct 68 ms 2296 KB Output is correct
35 Correct 65 ms 2168 KB Output is correct
36 Correct 64 ms 2168 KB Output is correct
37 Correct 67 ms 2168 KB Output is correct
38 Correct 618 ms 2324 KB Output is correct
39 Correct 517 ms 2296 KB Output is correct
40 Correct 377 ms 2424 KB Output is correct
41 Correct 1834 ms 2168 KB Output is correct
42 Correct 1089 ms 2136 KB Output is correct
43 Correct 864 ms 2164 KB Output is correct
44 Correct 1588 ms 2164 KB Output is correct
45 Correct 771 ms 1960 KB Output is correct
46 Correct 497 ms 2168 KB Output is correct
47 Correct 564 ms 1908 KB Output is correct
48 Correct 299 ms 1912 KB Output is correct
49 Correct 208 ms 2040 KB Output is correct