답안 #1102747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102747 2024-10-18T18:49:51 Z ttamx Topical (NOI23_topical) C++17
100 / 100
576 ms 132528 KB
#include<bits/stdc++.h>

using namespace std;

using ll = long long;

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<vector<ll>> a(n,vector<ll>(m)),b(n,vector<ll>(m));
    for(auto &v:a)for(auto &x:v)cin >> x;
    for(auto &v:b)for(auto &x:v)cin >> x;
    queue<int> q;
    vector<int> cnt(n);
    vector<ll> val(m);
    vector<priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>>> pq(m);
    for(int i=0;i<n;i++)for(int j=0;j<m;j++)pq[j].emplace(a[i][j],i);
    auto work=[&](){
        for(int i=0;i<m;i++){
            while(!pq[i].empty()&&pq[i].top().first<=val[i]){
                int v=pq[i].top().second;
                pq[i].pop();
                cnt[v]++;
                if(cnt[v]==m)q.emplace(v);
            }
        }
    };
    work();
    int ans=0;
    while(!q.empty()){
        int u=q.front();
        q.pop();
        ans++;
        for(int i=0;i<m;i++)val[i]+=b[u][i];
        work();
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 3 ms 1088 KB Output is correct
4 Correct 167 ms 86476 KB Output is correct
5 Correct 162 ms 86460 KB Output is correct
6 Correct 154 ms 86460 KB Output is correct
7 Correct 128 ms 86400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 3 ms 848 KB Output is correct
8 Correct 3 ms 848 KB Output is correct
9 Correct 2 ms 848 KB Output is correct
10 Correct 3 ms 848 KB Output is correct
11 Correct 3 ms 848 KB Output is correct
12 Correct 2 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 4 ms 1872 KB Output is correct
4 Correct 36 ms 14788 KB Output is correct
5 Correct 33 ms 14872 KB Output is correct
6 Correct 519 ms 132528 KB Output is correct
7 Correct 566 ms 132356 KB Output is correct
8 Correct 576 ms 132528 KB Output is correct
9 Correct 548 ms 132344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 3 ms 1088 KB Output is correct
4 Correct 167 ms 86476 KB Output is correct
5 Correct 162 ms 86460 KB Output is correct
6 Correct 154 ms 86460 KB Output is correct
7 Correct 128 ms 86400 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 3 ms 848 KB Output is correct
15 Correct 3 ms 848 KB Output is correct
16 Correct 2 ms 848 KB Output is correct
17 Correct 3 ms 848 KB Output is correct
18 Correct 3 ms 848 KB Output is correct
19 Correct 2 ms 848 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 4 ms 1872 KB Output is correct
23 Correct 36 ms 14788 KB Output is correct
24 Correct 33 ms 14872 KB Output is correct
25 Correct 519 ms 132528 KB Output is correct
26 Correct 566 ms 132356 KB Output is correct
27 Correct 576 ms 132528 KB Output is correct
28 Correct 548 ms 132344 KB Output is correct
29 Correct 216 ms 36680 KB Output is correct
30 Correct 223 ms 32328 KB Output is correct
31 Correct 335 ms 46276 KB Output is correct
32 Correct 164 ms 43512 KB Output is correct
33 Correct 169 ms 40172 KB Output is correct
34 Correct 235 ms 43256 KB Output is correct
35 Correct 278 ms 55136 KB Output is correct
36 Correct 271 ms 48412 KB Output is correct
37 Correct 288 ms 47804 KB Output is correct
38 Correct 193 ms 49616 KB Output is correct