結果

問題 No.199 星を描こう
ユーザー h_noson
提出日時 2016-04-28 21:27:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,112 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 65,152 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 17:21:39
合計ジャッジ時間 2,768 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 2
other AC * 18 WA * 3 RE * 4
権限があれば一括ダウンロードができます

ソースコード

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