답안 #392124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
392124 2021-04-20T14:19:38 Z soroush Geometrija (COCI21_geometrija) C++17
20 / 110
38 ms 820 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int , int> pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 2100;
const ll mod = 1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) cout << x , exit(0)
#define migmig ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(x , y) memset(x , y , sizeof x)
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;

struct point{ 
	ll x , y;
}p[maxn]; 

bool bad[maxn][maxn];

bool ccw(point A,point B,point C){
    return (C.y-A.y)*(B.x-A.x) > (B.y-A.y)*(C.x-A.x);
}

bool boom (point A,point B,point C,point D){
    return ccw(A,C,D) != ccw(B,C,D) and ccw(A,B,C) != ccw(A,B,D);
}

time_t start , now;

int32_t main(){
	migmig;
	cin >> n;
	for(int i = 1 ; i <= n ; i ++){
		cin >> p[i].x >> p[i].y;
	}
	time(&start); 
	int ans = 0;
	for(int i = 1 ; i <= n ; i ++){
		for(int j = i + 1 ; j <= n ; j ++){
			time(&now);
			if(now - start > 0.98)break;
			for(int k = 1 ; k <= n ; k ++){
				for(int l = k+1 ; l <= n ; l ++){
					if(i^k and i^l and j^k and j^l and boom(p[i] , p[j] , p[k] , p[l])){
						bad[k][l] = bad[i][j] = 1;
					}
					if(bad[i][j])break;
				}
				if(bad[i][j])break;
			}
		}
	}
	for(int i = 1 ; i <= n ; i ++){
		for(int j = i + 1 ; j <= n ; j ++){
			ans += !bad[i][j];
		}
	}
	cout << ans;
	return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 17 ms 820 KB Output is correct
13 Correct 19 ms 716 KB Output is correct
14 Correct 12 ms 652 KB Output is correct
15 Correct 11 ms 592 KB Output is correct
16 Correct 38 ms 708 KB Output is correct
17 Correct 27 ms 708 KB Output is correct
18 Incorrect 8 ms 452 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 17 ms 820 KB Output is correct
13 Correct 19 ms 716 KB Output is correct
14 Correct 12 ms 652 KB Output is correct
15 Correct 11 ms 592 KB Output is correct
16 Correct 38 ms 708 KB Output is correct
17 Correct 27 ms 708 KB Output is correct
18 Incorrect 8 ms 452 KB Output isn't correct
19 Halted 0 ms 0 KB -