結果
問題 | No.794 チーム戦 (2) |
ユーザー |
|
提出日時 | 2019-02-22 22:20:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 101 ms / 1,500 ms |
コード長 | 347 bytes |
コンパイル時間 | 582 ms |
コンパイル使用メモリ | 69,492 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 09:16:55 |
合計ジャッジ時間 | 3,224 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; long ans=1,mod=1e9+7; int n,k,a[2<<17]; main() { cin>>n>>k; for(int i=0;i<n;i++)cin>>a[i]; sort(a,a+n); int id=-1; for(int i=n;i-->n/2;) { if(id>=i)id=i-1; while(id<i-1&&a[id+1]+a[i]<=k)id++; if(id+1-(n-i-1)>0)ans=ans*(id+1-(n-i-1))%mod; else ans=0; } cout<<ans<<endl; }