結果

問題 No.2355 Unhappy Back Dance
ユーザー Jeroen Op de BeekJeroen Op de Beek
提出日時 2023-06-16 21:57:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 245 ms / 6,000 ms
コード長 1,910 bytes
コンパイル時間 2,929 ms
コンパイル使用メモリ 205,584 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 19:38:51
合計ジャッジ時間 7,562 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 114 ms
4,380 KB
testcase_07 AC 90 ms
4,376 KB
testcase_08 AC 91 ms
4,376 KB
testcase_09 AC 95 ms
4,380 KB
testcase_10 AC 186 ms
4,380 KB
testcase_11 AC 155 ms
4,380 KB
testcase_12 AC 99 ms
4,380 KB
testcase_13 AC 101 ms
4,376 KB
testcase_14 AC 133 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 244 ms
4,380 KB
testcase_17 AC 243 ms
4,380 KB
testcase_18 AC 245 ms
4,380 KB
testcase_19 AC 243 ms
4,380 KB
testcase_20 AC 237 ms
4,380 KB
testcase_21 AC 98 ms
4,376 KB
testcase_22 AC 18 ms
4,380 KB
testcase_23 AC 19 ms
4,380 KB
testcase_24 AC 220 ms
4,380 KB
testcase_25 AC 112 ms
4,380 KB
testcase_26 AC 117 ms
4,380 KB
testcase_27 AC 103 ms
4,380 KB
testcase_28 AC 3 ms
4,384 KB
testcase_29 AC 6 ms
4,380 KB
testcase_30 AC 203 ms
4,380 KB
testcase_31 AC 148 ms
4,376 KB
testcase_32 AC 14 ms
4,380 KB
testcase_33 AC 78 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 98 ms
4,384 KB
testcase_37 AC 49 ms
4,380 KB
testcase_38 AC 66 ms
4,376 KB
testcase_39 AC 49 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#define debug(a) cerr << "(" << #a << ": " << a << ")\n";
typedef __int128_t ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int mxN = 1e5+1, oo = 1e9;
typedef complex<long long> pt;
#define X real()
#define Y imag()
auto cross(pt u, pt v) {return (ll)u.X*v.Y-(ll)u.Y*v.X;}
auto sgn(ll a) {return a==0?0:(a>0?1:-1);}
auto ccw(pt p1, pt p2, pt p3) {auto u = p2-p1, v = p3-p2;return cross(u,v);}
auto in(pt p1, pt p2) {return (ll)p1.X*p2.X+(ll)p1.Y*p2.Y;}
auto norm(pt p) {return (ll)p.X*p.X+(ll)p.Y*p.Y;}
bool comp(const pt& a, const pt& b) { return a.X<b.X or (a.X==b.X and a.Y < b.Y);}
void read(pt& p) {
    long long a,b; cin >> a >> b;
    p = {a,b};
}
bool lexo(pt a, pt b) {
    return a.X<b.X or (a.X==b.X and a.Y > b.Y);
}
pt o;
bool polarcomp(const pt& a, const pt& b) {
    bool lex1 = lexo(o,a), lex2 = lexo(o,b);
    if(lex1!=lex2) return lex1<lex2;
    return ccw(o,a,b)>0;
}
int main() {
    int n; cin >> n;
    vector<pt> pts(n);
    for(auto& i : pts) read(i);
    int ans=0;
    for(int i=0;i<n;++i) {
        o = pts[i];
        vector<pt> v;
        v.reserve(n-1);
        for(int j=0;j<n;++j) if(i!=j) v.push_back(pts[j]);
        sort(all(v),polarcomp);
        for(int i=1;i<n-1;++i) {
            if(ccw(o,v[i-1],v[i])==0 and in(v[i-1]-o,v[i]-o)>0) {
                ans++;
                break;
            }
        }
    }
    cout << ans << '\n';
}
0