結果
問題 |
No.3284 Picnic with Friends
|
ユーザー |
|
提出日時 | 2025-09-26 23:01:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,087 bytes |
コンパイル時間 | 2,290 ms |
コンパイル使用メモリ | 207,640 KB |
実行使用メモリ | 14,856 KB |
最終ジャッジ日時 | 2025-09-26 23:02:49 |
合計ジャッジ時間 | 49,258 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main () { int N; cin >> N; std::vector<ll> S(N); for (ll& a : S) cin >> a; vector<int> ID(N); iota(ID.begin(), ID.end(), 0); { auto IDD = ID; sort(IDD.begin(), IDD.end(), [&](int i, int j) {return S[i] < S[j];}); for (int i = 0; i < N; i ++) { ID[IDD[i]] = i; } } sort(S.begin(), S.end()); vector<ll> TL; int Q; cin >> Q; { ll b = 0, e = 0, n = 0; while (Q--) { ll t, f; cin >> t >> f; if (e >= t) { e += f; } else { if (e - b) TL.push_back(e - b); b = t; e = t + f; } n = t; } } vector<ll> ans(1000, 0); for (int i = 1; i < 1000; i ++) { for (auto& f : TL) { ans[i] += f / i; } } vector<ll> A2(N + 1, 0); for (auto& f : TL) { for (ll s = 1; s * 1000 <= f; s ++) { ll d = f / s; A2[0] ++; int i = upper_bound(S.begin(), S.end(), d) - S.begin(); A2[i] --; } } for (int i = 1; i <= N; i ++) A2[i] += A2[i-1]; for (int& a : ID) { if (S[a] < 1000) { cout << ans[S[a]] << endl; } else { cout << A2[a] << endl; } } }