結果
問題 |
No.245 貫け!
|
ユーザー |
|
提出日時 | 2020-03-04 12:46:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 524 bytes |
コンパイル時間 | 625 ms |
コンパイル使用メモリ | 64,508 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 00:10:06 |
合計ジャッジ時間 | 1,292 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; int A[200],B[200]; int crs(int ax,int ay,int bx,int 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; int 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++) { int 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; }