結果
| 問題 | No.2453 Seat Allocation | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-09-01 22:15:27 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,228 bytes | 
| コンパイル時間 | 4,598 ms | 
| コンパイル使用メモリ | 256,460 KB | 
| 最終ジャッジ日時 | 2025-02-16 16:45:16 | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 2 TLE * 1 -- * 19 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
struct Fast {
  Fast() {
    std::cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
  }
} fast;
#define all(a) (a).begin(), (a).end()
#define contains(a, x) ((a).find(x) != (a).end())
#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (a); i--)
#define writejoin(s, a) rep(_i, 0, (a).size()) cout << (a)[_i] << (_i + 1 < (int)(a).size() ? s : "\n");
#define YN(b) cout << ((b) ? "YES" : "NO") << "\n";
#define Yn(b) cout << ((b) ? "Yes" : "No") << "\n";
#define yn(b) cout << ((b) ? "yes" : "no") << "\n";
using ll = long long;
int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n), b(m);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, m) cin >> b[i];
  using P = pair<int, int>;
  priority_queue<P, vector<P>, function<bool(P, P)>> pq([a, b](P x, P y) {
    ll v = a[x.first] * b[y.second] - a[y.first] * b[x.second];
    return v != 0 ? v < 0 : x.first > y.first;
  });
  rep(i, 0, n) pq.push(P(i, 0));
  rep(k, 0, m) {
    auto p = pq.top();
    pq.pop();
    cout << (p.first + 1) << endl;
    pq.push(P(p.first, p.second + 1));
  }
}
            
            
            
        