Submission #226268

#TimeUsernameProblemLanguageResultExecution timeMemory
226268dolphingarlicDragon 2 (JOI17_dragon2)C++14
100 / 100
2580 ms2420 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; struct Point { ll x, y; } A, B; bool ccw(Point X, Point Y, Point Z) { return (X.x - Y.x) * (Z.y - Y.y) <= (X.y - Y.y) * (Z.x - Y.x); } vector<Point> by_t[30001]; int main() { int n, m, q, x, y; scanf("%d %d", &n, &m); while (n--) { scanf("%lld %lld %d", &A.x, &A.y, &q); by_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 (Point i : by_t[x]) for (Point j : by_t[y]) { if (ccw(i, A, B)) m += (ccw(i, A, j) && ccw(j, B, i)); else m += (ccw(j, A, i) && ccw(i, B, j)); } printf("%d\n", m); } return 0; }

Compilation message (stderr)

dragon2.cpp: In function 'int main()':
dragon2.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
dragon2.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %d", &A.x, &A.y, &q);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld %lld\n%d", &A.x, &A.y, &B.x, &B.y, &q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dragon2.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &x, &y);
   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...