結果
問題 | No.1982 [Cherry 4th Tune B] 絶険 |
ユーザー | houren |
提出日時 | 2022-06-17 22:40:33 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 898 ms / 3,000 ms |
コード長 | 1,702 bytes |
コンパイル時間 | 1,851 ms |
コンパイル使用メモリ | 171,028 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-04-17 14:58:45 |
合計ジャッジ時間 | 15,516 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 7 ms
7,808 KB |
testcase_03 | AC | 90 ms
11,392 KB |
testcase_04 | AC | 143 ms
10,496 KB |
testcase_05 | AC | 146 ms
9,088 KB |
testcase_06 | AC | 316 ms
12,800 KB |
testcase_07 | AC | 382 ms
13,312 KB |
testcase_08 | AC | 162 ms
11,136 KB |
testcase_09 | AC | 299 ms
13,440 KB |
testcase_10 | AC | 237 ms
11,008 KB |
testcase_11 | AC | 95 ms
7,808 KB |
testcase_12 | AC | 250 ms
11,776 KB |
testcase_13 | AC | 96 ms
8,320 KB |
testcase_14 | AC | 88 ms
8,960 KB |
testcase_15 | AC | 106 ms
8,448 KB |
testcase_16 | AC | 266 ms
11,264 KB |
testcase_17 | AC | 606 ms
16,128 KB |
testcase_18 | AC | 497 ms
15,104 KB |
testcase_19 | AC | 594 ms
16,128 KB |
testcase_20 | AC | 33 ms
8,320 KB |
testcase_21 | AC | 139 ms
10,240 KB |
testcase_22 | AC | 132 ms
9,344 KB |
testcase_23 | AC | 71 ms
8,064 KB |
testcase_24 | AC | 86 ms
7,808 KB |
testcase_25 | AC | 417 ms
14,208 KB |
testcase_26 | AC | 491 ms
14,976 KB |
testcase_27 | AC | 40 ms
5,632 KB |
testcase_28 | AC | 61 ms
12,544 KB |
testcase_29 | AC | 898 ms
18,816 KB |
testcase_30 | AC | 684 ms
18,816 KB |
testcase_31 | AC | 68 ms
12,544 KB |
testcase_32 | AC | 842 ms
18,816 KB |
testcase_33 | AC | 682 ms
18,816 KB |
testcase_34 | AC | 639 ms
18,944 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll,ll>; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector<x>, greater<x> #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;} struct op{ ll l,r,c,h; }; struct query{ ll I,x; }; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,k,q; const ll d = 448; cin >> n >> k >> q; vector<op> a(k); rep(i,k){ cin >> a[i].l >> a[i].r >> a[i].c >> a[i].h; a[i].l--; } vector<ll> ans(q,-1); vector<query> b(q); rep(i,q){ cin >> b[i].I >> b[i].x; b[i].I--; } ll tail = 0; vector<ll> tot(n+1,0), imos(n+1,0); auto pre = tot; rep(i,k){ if(i*d>=k) break; pre = tot; tail += d; rep(j,n+1) imos[j] = 0; for(ll j=i*d;j<min(k,tail);j++){ imos[a[j].l] += a[j].h; imos[a[j].r] -= a[j].h; } rep(j,n){ tot[j] += imos[j]; imos[j+1] += imos[j]; } rep(j,q){ ll itr = b[j].I, nh = pre[itr]; if(ans[j]>0 || tot[itr]<b[j].x) continue; for(ll p=i*d;p<min(k,tail);p++){ if(a[p].l<=itr && itr<a[p].r){ nh += a[p].h; if(nh>=b[j].x){ ans[j] = a[p].c; break; } } } } } rep(i,q) cout << ans[i] << '\n'; return 0; }