結果

問題 No.1497 Triangle
ユーザー 👑 tatyamtatyam
提出日時 2021-05-03 13:02:31
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,198 bytes
コンパイル時間 1,094 ms
コンパイル使用メモリ 117,728 KB
実行使用メモリ 6,960 KB
最終ジャッジ日時 2023-09-29 08:24:01
合計ジャッジ時間 3,483 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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<<22)];

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