結果
問題 | No.794 チーム戦 (2) |
ユーザー | HIcoder |
提出日時 | 2024-02-19 01:06:56 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 203 ms / 1,500 ms |
コード長 | 2,769 bytes |
コンパイル時間 | 1,233 ms |
コンパイル使用メモリ | 118,132 KB |
実行使用メモリ | 46,332 KB |
最終ジャッジ日時 | 2024-02-19 01:07:04 |
合計ジャッジ時間 | 7,001 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge16 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
34,556 KB |
testcase_01 | AC | 31 ms
34,556 KB |
testcase_02 | AC | 33 ms
34,556 KB |
testcase_03 | AC | 33 ms
34,556 KB |
testcase_04 | AC | 30 ms
34,556 KB |
testcase_05 | AC | 30 ms
34,556 KB |
testcase_06 | AC | 30 ms
34,556 KB |
testcase_07 | AC | 29 ms
34,556 KB |
testcase_08 | AC | 30 ms
34,556 KB |
testcase_09 | AC | 31 ms
34,556 KB |
testcase_10 | AC | 30 ms
34,556 KB |
testcase_11 | AC | 31 ms
34,556 KB |
testcase_12 | AC | 32 ms
34,556 KB |
testcase_13 | AC | 31 ms
34,556 KB |
testcase_14 | AC | 184 ms
46,332 KB |
testcase_15 | AC | 188 ms
46,332 KB |
testcase_16 | AC | 183 ms
46,332 KB |
testcase_17 | AC | 203 ms
46,332 KB |
testcase_18 | AC | 180 ms
46,332 KB |
testcase_19 | AC | 177 ms
46,332 KB |
testcase_20 | AC | 185 ms
46,332 KB |
testcase_21 | AC | 182 ms
46,332 KB |
testcase_22 | AC | 121 ms
41,724 KB |
testcase_23 | AC | 107 ms
40,956 KB |
testcase_24 | AC | 94 ms
39,548 KB |
testcase_25 | AC | 89 ms
38,780 KB |
testcase_26 | AC | 91 ms
39,164 KB |
testcase_27 | AC | 137 ms
46,332 KB |
testcase_28 | AC | 127 ms
46,332 KB |
testcase_29 | AC | 127 ms
46,332 KB |
testcase_30 | AC | 122 ms
46,332 KB |
testcase_31 | AC | 128 ms
46,332 KB |
testcase_32 | AC | 128 ms
46,332 KB |
testcase_33 | AC | 138 ms
46,332 KB |
testcase_34 | AC | 129 ms
46,332 KB |
ソースコード
#include<iostream> #include<set> #include<algorithm> #include<vector> #include<string> #include<set> #include<map> #include<numeric> #include<queue> #include<cmath> #include<cassert> using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair<int,int> P; typedef pair<int,P> PP; const ll MOD=1e9+7; const int mod = 1e9+7; struct mint { long long x; // typedef long long long long; mint(long long x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;}//後ろのconstはメンバxを変更しないことを示す mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} bool operator==(const mint a) const {return a.x==x;} mint pow(long long t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; std::istream& operator>>(std::istream& is, mint& a) { return is >> a.x;} std::ostream& operator<<(std::ostream& os, const mint& a) { return os << a.x;} struct combination { std::vector<mint> fact, ifact; combination(int n):fact(n+1),ifact(n+1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n]*ifact[k]*ifact[n-k]; } }; combination comb(2*1000000+10); //mint dp[105][2*10000+10]; int main(){ int N,K; cin>>N>>K; vector<ll> A(N); for(int i=0;i<N;i++){ cin>>A[i]; } sort(A.begin(),A.end()); vector<int> B(N); for(int i=0;i<N;i++){ //K-A[i]以下 auto it=upper_bound(A.begin(),A.end(),K-A[i]); int num=min(i,(int)(it-A.begin()));//[A.begin(),it) B[i]=max(num,0); } for(int i=0;i<N;i++){ //cout<<B[i]<<(i==N-1?'\n':' '); } set<int> st; for(int k=0;k<N;k++)st.insert(k); mint ans=1; for(int i=0;i<N/2;i++){ //i回目の操作 auto it=st.rbegin(); int k=*it;//レートが最大の人でまだ使われていない st.erase(k); int c=B[k]-i; ans*=max(0,c); } cout<<ans<<endl; }