結果

問題 No.1497 Triangle
ユーザー 👑 tatyamtatyam
提出日時 2021-05-03 12:03:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,198 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 118,512 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 06:52:26
合計ジャッジ時間 5,739 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 RE -
testcase_23 AC 2 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
testcase_27 RE -
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 3 ms
4,380 KB
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

typedef long long ll;

ll x[30],y[30];
bool can[(1<<20)];

ll area(int p, int q, int r){
	return (x[q] - x[p]) * (y[r] - y[p]) - (x[r] - x[p]) * (y[q] - y[p]);
}

ll dist(int p, int q){
	return (x[q] - x[p]) * (x[q] - x[p]) + (y[q] - y[p]) * (y[q] - y[p]);
}

int main(void){
	int N,i,j,k,ans=0;
	
	cin >> N;
	REP(i,N) cin >> x[i] >> y[i];
	
	vector <int> v;
	v.push_back(0);
	v.push_back((1<<N)-1);
	
	REP(i,N) REP(j,N) if(j != i){
		int mask = 0;
		REP(k,N) if(area(i, j, k) > 0 || (area(i, j, k) == 0 && dist(i, k) > dist(j, k))) mask |= (1<<k);
		v.push_back(mask);
	}
	
	REP(i,v.size()) REP(j,i+1) REP(k,j+1) can[v[i]&v[j]&v[k]] = true;
	
	REP(i,(1<<N)) if(can[i]) ans++;
	
	cout << ans << endl;
	
	return 0;
}
0