# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
828104 | 2023-08-17T04:44:59 Z | 반딧불(#10380) | Topical (NOI23_topical) | C++17 | 308 ms | 74872 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int n, k; ll lim[1000002], add[1000002]; vector<pair<ll, int> > que[1000002]; int cnt[1000002]; int score[1000002]; int ans; queue<int> canDo; void activate(int x){ while(!que[x].empty() && que[x].back().first <= score[x]){ int i = que[x].back().second; que[x].pop_back(); cnt[i]--; if(!cnt[i]) canDo.push(i); } } int main(){ scanf("%d %d", &n, &k); for(int i=0; i<n*k; i++) scanf("%lld", &lim[i]); for(int i=0; i<n*k; i++) scanf("%lld", &add[i]); for(int i=0; i<n; i++){ cnt[i] = k; for(int j=0; j<k; j++){ que[j].push_back(make_pair(lim[i*k+j], i)); } } for(int i=0; i<k; i++){ sort(que[i].rbegin(), que[i].rend()); activate(i); } while(!canDo.empty()){ int x = canDo.front(); canDo.pop(); ans++; for(int i=0; i<k; i++){ score[i] += add[x*k+i]; activate(i); } } printf("%d", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 14 ms | 23796 KB | Output is correct |
3 | Correct | 14 ms | 24340 KB | Output is correct |
4 | Correct | 204 ms | 74872 KB | Output is correct |
5 | Correct | 219 ms | 74828 KB | Output is correct |
6 | Correct | 208 ms | 74864 KB | Output is correct |
7 | Correct | 177 ms | 71004 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23728 KB | Output is correct |
2 | Correct | 13 ms | 23800 KB | Output is correct |
3 | Correct | 16 ms | 23792 KB | Output is correct |
4 | Correct | 13 ms | 23764 KB | Output is correct |
5 | Correct | 12 ms | 23788 KB | Output is correct |
6 | Correct | 13 ms | 23764 KB | Output is correct |
7 | Correct | 14 ms | 24348 KB | Output is correct |
8 | Correct | 15 ms | 24316 KB | Output is correct |
9 | Correct | 14 ms | 24276 KB | Output is correct |
10 | Correct | 15 ms | 24380 KB | Output is correct |
11 | Correct | 15 ms | 24368 KB | Output is correct |
12 | Correct | 16 ms | 24348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23828 KB | Output is correct |
3 | Correct | 16 ms | 24448 KB | Output is correct |
4 | Correct | 40 ms | 28008 KB | Output is correct |
5 | Correct | 40 ms | 28064 KB | Output is correct |
6 | Correct | 308 ms | 60544 KB | Output is correct |
7 | Correct | 276 ms | 59184 KB | Output is correct |
8 | Correct | 307 ms | 60552 KB | Output is correct |
9 | Correct | 282 ms | 59188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 14 ms | 23796 KB | Output is correct |
3 | Correct | 14 ms | 24340 KB | Output is correct |
4 | Correct | 204 ms | 74872 KB | Output is correct |
5 | Correct | 219 ms | 74828 KB | Output is correct |
6 | Correct | 208 ms | 74864 KB | Output is correct |
7 | Correct | 177 ms | 71004 KB | Output is correct |
8 | Correct | 12 ms | 23728 KB | Output is correct |
9 | Correct | 13 ms | 23800 KB | Output is correct |
10 | Correct | 16 ms | 23792 KB | Output is correct |
11 | Correct | 13 ms | 23764 KB | Output is correct |
12 | Correct | 12 ms | 23788 KB | Output is correct |
13 | Correct | 13 ms | 23764 KB | Output is correct |
14 | Correct | 14 ms | 24348 KB | Output is correct |
15 | Correct | 15 ms | 24316 KB | Output is correct |
16 | Correct | 14 ms | 24276 KB | Output is correct |
17 | Correct | 15 ms | 24380 KB | Output is correct |
18 | Correct | 15 ms | 24368 KB | Output is correct |
19 | Correct | 16 ms | 24348 KB | Output is correct |
20 | Correct | 12 ms | 23764 KB | Output is correct |
21 | Correct | 12 ms | 23828 KB | Output is correct |
22 | Correct | 16 ms | 24448 KB | Output is correct |
23 | Correct | 40 ms | 28008 KB | Output is correct |
24 | Correct | 40 ms | 28064 KB | Output is correct |
25 | Correct | 308 ms | 60544 KB | Output is correct |
26 | Correct | 276 ms | 59184 KB | Output is correct |
27 | Correct | 307 ms | 60552 KB | Output is correct |
28 | Correct | 282 ms | 59188 KB | Output is correct |
29 | Correct | 238 ms | 59720 KB | Output is correct |
30 | Correct | 251 ms | 55596 KB | Output is correct |
31 | Correct | 272 ms | 56008 KB | Output is correct |
32 | Correct | 201 ms | 59972 KB | Output is correct |
33 | Correct | 213 ms | 55640 KB | Output is correct |
34 | Correct | 245 ms | 58312 KB | Output is correct |
35 | Correct | 270 ms | 55960 KB | Output is correct |
36 | Correct | 230 ms | 58288 KB | Output is correct |
37 | Correct | 254 ms | 58272 KB | Output is correct |
38 | Correct | 206 ms | 55900 KB | Output is correct |