답안 #226267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
226267 2020-04-23T09:02:31 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
0 / 100
1227 ms 1676 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\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

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:53: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll* {aka long long int*}' [-Wformat=]
  scanf("%d %d %d %d\n%d", &A.x, &A.y, &B.x, &B.y, &q);
                           ~~~~                      ^
dragon2.cpp:18:53: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'll* {aka long long int*}' [-Wformat=]
dragon2.cpp:18:53: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'll* {aka long long int*}' [-Wformat=]
dragon2.cpp:18:53: 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\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);
   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1227 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -