結果
問題 |
No.794 チーム戦 (2)
|
ユーザー |
|
提出日時 | 2019-02-23 18:20:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 41 ms / 1,500 ms |
コード長 | 893 bytes |
コンパイル時間 | 622 ms |
コンパイル使用メモリ | 73,772 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 21:48:19 |
合計ジャッジ時間 | 2,794 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include<iostream> #include<string> #include<iomanip> #include<cmath> #include<vector> #include<algorithm> using namespace std; #define int long long #define rep(i,n) for(int i = 0; i < (n); i++) #define INF ((long long)1e18) #define MOD ((int)1e9+7) #define endl "\n" #define yn(f) ((f)?"Yes":"No") #define YN(f) ((f)?"YES":"NO") #define MAX 210000 int N, K; int A[MAX], B[MAX]; signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout<<fixed<<setprecision(10); int ans = 1; cin>>N>>K; for(int i = 0; i < N; i++){ cin>>A[i]; } sort(A, A+N, greater<int>()); for(int i = 0, j = N-1; i < N/2; i++){ for(;j > i; j--){ if(A[i]+A[j] > K) break; } j = max(i,j); // cout<<i<<" "<<j<<" "<<A[i]<<" "<<A[j]<<endl; // cout<<"ans = "<<ans<<" "<<j<<" "<<(N-1-j)<<" "<<(N-1-j-i)-i<<endl; ans *= (N-1-j)-i; ans %= MOD; } cout<<ans<<endl; return 0; }