結果
問題 | No.2453 Seat Allocation |
ユーザー | hiro71687k |
提出日時 | 2023-09-01 21:52:45 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 1,366 bytes |
コンパイル時間 | 4,232 ms |
コンパイル使用メモリ | 266,148 KB |
実行使用メモリ | 16,868 KB |
最終ジャッジ日時 | 2023-09-07 15:35:14 |
合計ジャッジ時間 | 8,484 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 227 ms
16,868 KB |
testcase_06 | AC | 165 ms
4,684 KB |
testcase_07 | AC | 39 ms
15,256 KB |
testcase_08 | AC | 20 ms
4,696 KB |
testcase_09 | AC | 230 ms
16,596 KB |
testcase_10 | AC | 238 ms
16,720 KB |
testcase_11 | AC | 232 ms
16,656 KB |
testcase_12 | AC | 165 ms
4,852 KB |
testcase_13 | AC | 174 ms
5,080 KB |
testcase_14 | AC | 169 ms
4,692 KB |
testcase_15 | AC | 184 ms
4,796 KB |
testcase_16 | AC | 166 ms
4,644 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 189 ms
10,228 KB |
testcase_19 | AC | 198 ms
15,576 KB |
testcase_20 | AC | 84 ms
8,960 KB |
testcase_21 | AC | 124 ms
5,636 KB |
testcase_22 | AC | 185 ms
7,412 KB |
testcase_23 | AC | 2 ms
4,376 KB |
testcase_24 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll mod=1000000007; ld inf=10000999999999900; pair<ld,pair<ll,ll>> op(pair<ld,pair<ll,ll>> a,pair<ld,pair<ll,ll>> b){ if (a.first>b.first) { return a; }else if (a.first==b.first) { if (a.second.first<b.second.first) { return a; }else{ return b; } }else{ return b; } } pair<ld,pair<ll,ll>>e(){ return {-inf,{-inf,-inf}}; } int main(){ ll n,m; cin >> n >> m; vector<ll>a(n),b(m); for (ll i = 0; i < n; i++) { cin >> a[i]; } for (ll i = 0; i < m; i++) { cin >> b[i]; } sort(b.begin(),b.end()); b.push_back(inf); vector<pair<ld,pair<ll,ll>>>p(n); for (ll i = 0; i < n; i++) { p[i]={(ld)((ld)a[i]/(ld)b[0]),{i,0}}; } segtree<pair<ld,pair<ll,ll>>,op,e>seg(p); vector<ll>ans(m); for (ll i = 0; i < m; i++) { pair<ld,pair<ll,ll>>pp=seg.all_prod(); ans[i]=pp.second.first+1; pp.second.second++; pp.first=(ld)((ld)a[pp.second.first]/(ld)b[pp.second.second]); seg.set(pp.second.first,pp); } for (ll i = 0; i < m; i++) { cout << ans[i] << endl; } }