Submission #226272

#TimeUsernameProblemLanguageResultExecution timeMemory
226272dolphingarlicDragon 2 (JOI17_dragon2)C++14
100 / 100
2627 ms3960 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...