結果
問題 | No.2453 Seat Allocation |
ユーザー | binap |
提出日時 | 2023-09-01 21:51:29 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 116 ms / 2,000 ms |
コード長 | 901 bytes |
コンパイル時間 | 3,996 ms |
コンパイル使用メモリ | 232,288 KB |
実行使用メモリ | 8,508 KB |
最終ジャッジ日時 | 2023-09-07 15:35:13 |
合計ジャッジ時間 | 6,266 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 103 ms
8,124 KB |
testcase_06 | AC | 51 ms
4,376 KB |
testcase_07 | AC | 24 ms
8,508 KB |
testcase_08 | AC | 8 ms
4,376 KB |
testcase_09 | AC | 116 ms
8,312 KB |
testcase_10 | AC | 116 ms
8,456 KB |
testcase_11 | AC | 116 ms
8,128 KB |
testcase_12 | AC | 50 ms
4,376 KB |
testcase_13 | AC | 55 ms
4,376 KB |
testcase_14 | AC | 50 ms
4,380 KB |
testcase_15 | AC | 60 ms
4,376 KB |
testcase_16 | AC | 45 ms
4,376 KB |
testcase_17 | AC | 1 ms
4,376 KB |
testcase_18 | AC | 75 ms
5,832 KB |
testcase_19 | AC | 93 ms
7,868 KB |
testcase_20 | AC | 38 ms
5,508 KB |
testcase_21 | AC | 48 ms
4,520 KB |
testcase_22 | AC | 68 ms
5,076 KB |
testcase_23 | AC | 1 ms
4,376 KB |
testcase_24 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:35:22: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 35 | auto [rational_tmp, j] = pq.top(); pq.pop(); | ^
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; using namespace atcoder; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<vector<int>> vvi; typedef vector<vector<long long>> vvl; typedef pair<int,int> P; typedef long double ld; struct Rational{ ll p, q; Rational(ll p, ll q) : p(p), q(q) {} bool operator<(const Rational& right) const{ return p * right.q < q * right.p; } }; int main(){ int n, m; cin >> n >> m; vl a(n), b(m); rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; priority_queue<pair<Rational, ll>> pq; vi cnt(n); rep(i, n){ Rational rational(a[i], b[0]); pq.emplace(rational, -i); } rep(i, m){ auto [rational_tmp, j] = pq.top(); pq.pop(); j *= -1; cout << j + 1 << "\n"; cnt[j]++; Rational rational(a[j], b[cnt[j]]); pq.emplace(rational, -j); } return 0; }