Submission #912892

# Submission time Handle Problem Language Result Execution time Memory
912892 2024-01-20T04:05:22 Z vjudge1 Topical (NOI23_topical) C++17
100 / 100
789 ms 83296 KB
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
#define ll  long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>> arr[k];
    for(int i = 0;i<n;i++){
        for(int j =0 ;j<k;j++){
            int x;
            cin>>x;
            arr[j].pb({x,i});
        }
    }
    vector<vector<int>> u(n+1,vector<int>(k));
    for(int i = 0;i<n;i++){
        for(int j =0;j<k;j++)cin>>u[i][j];
    }
    for(int i =0;i<k;i++)u[n][i]=0;
    vector<int> currK(k,0);
    queue<int> q;
    q.push(n);
    vector<int> cntTop(n+1,0);
    int cnt = -1;
    for(int i = 0;i<k;i++)sort(arr[i].begin(),arr[i].end(),greater<pair<int,int>>());
    while(!q.empty()){
        int curr = q.front();
        q.pop();
        cnt++;
        for(int i =0;i<k;i++){
            currK[i]+=u[curr][i];
            while(!arr[i].empty()&&currK[i]>=arr[i].back().ff){
                cntTop[arr[i].back().ss]++;
                if(cntTop[arr[i].back().ss]==k)q.push(arr[i].back().ss);
                arr[i].pop_back();
            }
        }
    }
    cout<<cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 6 ms 1116 KB Output is correct
4 Correct 540 ms 78404 KB Output is correct
5 Correct 489 ms 78520 KB Output is correct
6 Correct 560 ms 78536 KB Output is correct
7 Correct 363 ms 72620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 7 ms 604 KB Output is correct
8 Correct 7 ms 768 KB Output is correct
9 Correct 4 ms 604 KB Output is correct
10 Correct 6 ms 764 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 9 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 7 ms 1220 KB Output is correct
4 Correct 71 ms 8456 KB Output is correct
5 Correct 57 ms 8320 KB Output is correct
6 Correct 767 ms 83296 KB Output is correct
7 Correct 775 ms 80304 KB Output is correct
8 Correct 789 ms 83080 KB Output is correct
9 Correct 698 ms 80336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 6 ms 1116 KB Output is correct
4 Correct 540 ms 78404 KB Output is correct
5 Correct 489 ms 78520 KB Output is correct
6 Correct 560 ms 78536 KB Output is correct
7 Correct 363 ms 72620 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 7 ms 604 KB Output is correct
15 Correct 7 ms 768 KB Output is correct
16 Correct 4 ms 604 KB Output is correct
17 Correct 6 ms 764 KB Output is correct
18 Correct 7 ms 604 KB Output is correct
19 Correct 9 ms 604 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 7 ms 1220 KB Output is correct
23 Correct 71 ms 8456 KB Output is correct
24 Correct 57 ms 8320 KB Output is correct
25 Correct 767 ms 83296 KB Output is correct
26 Correct 775 ms 80304 KB Output is correct
27 Correct 789 ms 83080 KB Output is correct
28 Correct 698 ms 80336 KB Output is correct
29 Correct 604 ms 32856 KB Output is correct
30 Correct 615 ms 29636 KB Output is correct
31 Correct 600 ms 30756 KB Output is correct
32 Correct 400 ms 23484 KB Output is correct
33 Correct 435 ms 22312 KB Output is correct
34 Correct 482 ms 24860 KB Output is correct
35 Correct 547 ms 27508 KB Output is correct
36 Correct 517 ms 28200 KB Output is correct
37 Correct 624 ms 30644 KB Output is correct
38 Correct 320 ms 19776 KB Output is correct