Submission #363673

#TimeUsernameProblemLanguageResultExecution timeMemory
363673denkendoemeerDragon 2 (JOI17_dragon2)C++14
100 / 100
2531 ms3948 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; struct pct { ll x,y; }a,b; bool cmp(pct x,pct y,pct z) { if ((x.x-y.x)*(z.y-y.y)<(x.y-y.y)*(z.x-y.x)) return 1; return 0; } vector<pct>g[30005]; int main() { //freopen(".in","r",stdin); //freopen(".out","w",stdout); int n,m,t,x,y,q; scanf("%d%d",&n,&m); int i; for(i=1;i<=n;i++){ scanf("%lld%lld%d",&a.x,&a.y,&t); g[t].push_back(a); } scanf("%lld%lld%lld%lld%d",&a.x,&a.y,&b.x,&b.y,&q); for(i=1;i<=q;i++){ scanf("%d%d",&x,&y); int ans=0; for(auto it:g[x]) for(auto it2:g[y]){ if (cmp(it,a,b)) if (cmp(it,a,it2) && cmp(it2,b,it)) ans++; else ; else if (cmp(it2,a,it) && cmp(it,b,it2)) ans++; } printf("%d\n",ans); } return 0; }

Compilation message (stderr)

dragon2.cpp: In function 'int main()':
dragon2.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
dragon2.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         scanf("%lld%lld%d",&a.x,&a.y,&t);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |     scanf("%lld%lld%lld%lld%d",&a.x,&a.y,&b.x,&b.y,&q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   28 |         scanf("%d%d",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...