結果
問題 | No.2453 Seat Allocation |
ユーザー |
|
提出日時 | 2023-09-01 22:53:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,152 bytes |
コンパイル時間 | 2,129 ms |
コンパイル使用メモリ | 202,336 KB |
最終ジャッジ日時 | 2025-02-16 17:09:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {cin.tie(0); cout.tie(0);ios::sync_with_stdio(false);int N, M;cin >> N >> M;vector<int> A(N), B(M);vector<pair<int, int>> v(N);for(int i = 0; i < N; i++) {cin >> A[i];}for(int i = 0; i < M; i++) {cin >> B[i];}long double ok = 1e-10, ng = 1e10;for(int t = 0; t < 100; t++) {long double m = (ok + ng) / 2;int cnt = 0;for(int i = 0; i < N; i++) {if(cnt >= M) {break;}for(int j = 0; j < M; j++) {if((long double) A[i] / B[j] >= m) {cnt++;if(cnt >= M) {break;}} else {break;}}}if(cnt >= M) {ok = m;} else {ng = m;}}priority_queue<pair<long double, int>> pq;for(int i = 0; i < N; i++) {for(int j = 0; j < M; j++) {if((long double) A[i] / B[j] >= ok) {pq.push(make_pair(A[i] / B[j], -i));} else {break;}}}for(int i = 0; i < M; i++) {auto [c, id] = pq.top();pq.pop();cout << 1 - id << '\n';}return 0;}