結果
問題 |
No.245 貫け!
|
ユーザー |
|
提出日時 | 2020-03-04 12:45:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 5,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 65,012 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 00:10:04 |
合計ジャッジ時間 | 1,324 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; int A[200],B[200]; long crs(long ax,long ay,long bx,long by) { return ax*by-ay*bx; } main() { cin>>N; for(int i=0;i<2*N;i++)cin>>A[i]>>B[i]; int ans=0; for(int i=0;i<2*N;i++)for(int j=i+1;j<2*N;j++) { int cnt=0; long ax=A[i],ay=B[i],bx=A[j],by=B[j]; if(ax==bx&&ay==by)continue; for(int k=0;k<N;k++) { long cx=A[2*k],cy=B[2*k],dx=A[2*k+1],dy=B[2*k+1]; cnt+=crs(bx-ax,by-ay,cx-ax,cy-ay)*crs(bx-ax,by-ay,dx-ax,dy-ay)<=0; } if(ans<cnt)ans=cnt; } cout<<ans<<endl; }