Submission #226266

# Submission time Handle Problem Language Result Execution time Memory
226266 2020-04-23T09:02:11 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
0 / 100
1220 ms 1716 KB
#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("%d %d %d", &A.x, &A.y, &q);
		by_t[q].push_back(A);
	}
	scanf("%d %d %d %d %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

dragon2.cpp: In function 'int main()':
dragon2.cpp:15:35: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll* {aka long long int*}' [-Wformat=]
   scanf("%d %d %d", &A.x, &A.y, &q);
                     ~~~~          ^
dragon2.cpp:15:35: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'll* {aka long long int*}' [-Wformat=]
dragon2.cpp:18:52: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll* {aka long long int*}' [-Wformat=]
  scanf("%d %d %d %d %d", &A.x, &A.y, &B.x, &B.y, &q);
                          ~~~~                      ^
dragon2.cpp:18:52: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'll* {aka long long int*}' [-Wformat=]
dragon2.cpp:18:52: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'll* {aka long long int*}' [-Wformat=]
dragon2.cpp:18:52: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'll* {aka long long int*}' [-Wformat=]
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("%d %d %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("%d %d %d %d %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 time Memory Grader output
1 Incorrect 18 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1220 ms 1716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -