結果

問題 No.2355 Unhappy Back Dance
ユーザー lgswdnlgswdn
提出日時 2023-06-16 21:49:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 6,000 ms
コード長 2,003 bytes
コンパイル時間 2,298 ms
コンパイル使用メモリ 201,052 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 19:21:16
合計ジャッジ時間 5,992 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 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 7 ms
4,380 KB
testcase_07 AC 49 ms
4,384 KB
testcase_08 AC 49 ms
4,380 KB
testcase_09 AC 48 ms
4,376 KB
testcase_10 AC 87 ms
4,380 KB
testcase_11 AC 55 ms
4,376 KB
testcase_12 AC 47 ms
4,384 KB
testcase_13 AC 46 ms
4,380 KB
testcase_14 AC 55 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 154 ms
4,376 KB
testcase_17 AC 154 ms
4,380 KB
testcase_18 AC 151 ms
4,376 KB
testcase_19 AC 149 ms
4,380 KB
testcase_20 AC 153 ms
4,380 KB
testcase_21 AC 61 ms
4,376 KB
testcase_22 AC 11 ms
4,380 KB
testcase_23 AC 12 ms
4,380 KB
testcase_24 AC 142 ms
4,380 KB
testcase_25 AC 68 ms
4,380 KB
testcase_26 AC 68 ms
4,376 KB
testcase_27 AC 59 ms
4,380 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 4 ms
4,380 KB
testcase_30 AC 121 ms
4,376 KB
testcase_31 AC 91 ms
4,380 KB
testcase_32 AC 8 ms
4,376 KB
testcase_33 AC 49 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 59 ms
4,376 KB
testcase_37 AC 30 ms
4,380 KB
testcase_38 AC 38 ms
4,380 KB
testcase_39 AC 31 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
  return x*w;
}

const int N=1505;
int n,x[N],y[N],ans;
struct vec {int x,y;} p[N],q[N];

bool cmp(const vec &a,const vec &b) {
  return a.y*b.x<a.x*b.y;
}
bool eq(const vec &a,const vec &b) {
  return a.y*b.x==a.x*b.y;
}

signed main() {
  n=read();
  rep(i,1,n) x[i]=read(), y[i]=read();
  rep(i,1,n) {
    int cleft=0,cright=0,t1=0,t2=0;
    rep(j,1,n) if(i!=j) {
      if(x[i]==x[j]&&y[i]<y[j]) cright++;
      else if(x[i]==x[j]&&y[i]>y[j]) cleft++;
      else if(x[i]<x[j]) p[++t1]=(vec){x[j]-x[i],y[j]-y[i]};
      else q[++t2]=(vec){x[j]-x[i],y[j]-y[i]};
    }
    sort(p+1,p+t1+1,cmp);
    sort(q+1,q+t2+1,cmp);
    bool res=(cleft>1)||(cright>1);
    rep(i,1,t1-1) res|=(eq(p[i],p[i+1]));
    rep(i,1,t2-1) res|=(eq(q[i],q[i+1]));
    ans+=res;
  }
  printf("%lld\n",ans);
  return 0;
}
0