結果

問題 No.199 星を描こう
ユーザー h_nosonh_noson
提出日時 2016-04-28 21:27:43
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,112 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 64,812 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 05:12:07
合計ジャッジ時間 2,258 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;
typedef pair<int,int> P;

int det(P a, P b) {
    return a.first * b.second - a.second * b.first;
}

P operator-(P a, P b) {
    return make_pair(a.first-b.first,a.second-b.second);
}

bool cmp(P a, P b) {
    if (a.first == b.first)
        return a.second > b.second;
    else
        return a.first < b.first;
}

int main() {
    int i, k;
    P p[5], out[5];
    rep (i,5) {
        int x, y;
        cin >> x >> y;
        p[i] = make_pair(x,y);
    }
    sort(p,p+5,cmp);
    k = 0;
    rep (i,5) {
        while (k > 1 && det(out[k-1]-out[k-2],p[i]-out[k-1]) <= 0) k--;
        out[k++] = p[i];
    }
    rrep(i,5) {
        while (k > 1 && det(out[k-1]-out[k-2],p[i]-out[k-1]) <= 0) k--;
        out[k++] = p[i];
    }
    k--;
    if (k == 5)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}
0