結果

問題 No.199 星を描こう
ユーザー 夜
提出日時 2021-02-07 04:45:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,550 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 92,320 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 16:50:20
合計ジャッジ時間 1,993 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long double x[5], y[5];
int main() {
	for (int i = 0; i < 5; i++) {
		cin >> x[i] >> y[i];
	}
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				long double xi = x[i], yi = y[i];
				long double xj = x[j], yj = y[j];
				long double xk = x[k], yk = y[k];
				xi -= xk, yi -= yk;
				xj -= xk, yj -= yk;
				if (xi * yj == xj * yi) {
					cout << "NO" << endl;
					return 0;
				}
			}
		}
	}
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			for (int k = 0; k < 5; k++) {
				for (int l = 0; l < 5; l++) {
					if (i != j && i != k && i != l && j != k && j != l && k != l) {
						long double xi = x[i], yi = y[i];
						long double xj = x[j], yj = y[j];
						long double xk = x[k], yk = y[k];
						long double xl = x[l], yl = y[l];
						long double m = 0.5 * (-yj * xk + yi * (-xj + xk) + xi * (yj - yk) + xj * yk);
						long double s = 1 / (2 * m) * (yi * xk - xi * yk + (yk - yi) * xl + (xi - xk) * yl);
						long double t = 1 / (2 * m) * (xi * yj - yi * xj + (yi - yj) * xl + (xj - xi) * yl);
						if (0 < s && s < 1 && 0 < t && t < 1 && 0 < 1 - s - t && 1 - s - t < 1) {
							cout << "NO" << endl;
							return 0;
						}
					}
				}
			}
		}
	}
	cout << "YES" << endl;
}

0