답안 #776577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776577 2023-07-08T04:24:48 Z jamezzz Dragon 2 (JOI17_dragon2) C++17
15 / 100
188 ms 25784 KB
#include <bits/stdc++.h>
using namespace std;
 
#define sf scanf
#define pf printf
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define LINF 1023456789123456789
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,int> li;
typedef long double ld;

#define maxn 3005

int n,m,a[maxn],b[maxn],c[maxn],ans[maxn][maxn];
int d1,e1,d2,e2;

ld get(ll a1,ll b1,ll a2,ll b2,ll d1,ll e1,ll d2,ll e2){
	return (ld)((a2-a1)*(b1-e1)+(b2-b1)*(d1-a1))/((e2-e1)*(a2-a1)-(b2-b1)*(d2-d1));
}

int main(){
	sf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		sf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	sf("%d%d%d%d",&d1,&e1,&d2,&e2);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			if(i==j)continue;
			ld mu=get(a[i],b[i],a[j],b[j],d1,e1,d2,e2);
			ld la=get(d1,e1,d2,e2,a[i],b[i],a[j],b[j]);
			if(0<=mu&&mu<=1&&la>0)++ans[c[i]][c[j]];
		}
	}
	int q;sf("%d",&q);
	for(int i=0;i<q;++i){
		int f,g;sf("%d%d",&f,&g);
		pf("%d\n",ans[f][g]);
	}
}

Compilation message

dragon2.cpp: In function 'int main()':
dragon2.cpp:27:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |  sf("%d%d",&n,&m);
      |    ^
dragon2.cpp:29:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |   sf("%d%d%d",&a[i],&b[i],&c[i]);
      |     ^
dragon2.cpp:31:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |  sf("%d%d%d%d",&d1,&e1,&d2,&e2);
      |    ^
dragon2.cpp:40:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  int q;sf("%d",&q);
      |          ^
dragon2.cpp:42:13: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |   int f,g;sf("%d%d",&f,&g);
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 144 ms 320 KB Output is correct
2 Correct 149 ms 428 KB Output is correct
3 Correct 149 ms 916 KB Output is correct
4 Correct 151 ms 8060 KB Output is correct
5 Correct 188 ms 25784 KB Output is correct
6 Correct 87 ms 2180 KB Output is correct
7 Correct 91 ms 2356 KB Output is correct
8 Correct 124 ms 392 KB Output is correct
9 Correct 40 ms 340 KB Output is correct
10 Correct 41 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 144 ms 320 KB Output is correct
2 Correct 149 ms 428 KB Output is correct
3 Correct 149 ms 916 KB Output is correct
4 Correct 151 ms 8060 KB Output is correct
5 Correct 188 ms 25784 KB Output is correct
6 Correct 87 ms 2180 KB Output is correct
7 Correct 91 ms 2356 KB Output is correct
8 Correct 124 ms 392 KB Output is correct
9 Correct 40 ms 340 KB Output is correct
10 Correct 41 ms 340 KB Output is correct
11 Runtime error 2 ms 724 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -