답안 #1102320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102320 2024-10-18T02:16:32 Z SoMotThanhXuan Topical (NOI23_topical) C++17
100 / 100
461 ms 95676 KB
#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 1;
int N, K, res;
int last[maxN], complete[maxN];
vector<pair<int, int>> r[maxN];
vector<int> u[maxN];
long long p[maxN];
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> N >> K;
    for(int i = 1; i <= N; ++i){
        for(int j = 1, x; j <= K; ++j){
            cin >> x;
            r[j].push_back(make_pair(x, i));
        }
    }
    for(int i = 1; i <= K; ++i)sort(r[i].begin(), r[i].end());
    for(int i = 1; i <= N; ++i){
        for(int j = 1, x; j <= K; ++j){
            cin >> x;
            u[i].push_back(x);
        }
    }
    int res = 0;
    while(true){
        vector<int> pass;
        for(int j = 1; j <= K; ++j){
            while(last[j] < N && r[j][last[j]].first <= p[j]){
                int i = last[j];
                ++complete[r[j][i].second];
                if(complete[r[j][i].second] == K)pass.push_back(r[j][i].second);
                ++last[j];
            }
        }
        if(pass.empty())break;
        res += pass.size();
        for(int j = 1; j <= K; ++j){
            for(int id : pass){
                p[j] += u[id][j - 1];
            }
        }
    }
    cout << res;
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 49488 KB Output is correct
2 Correct 10 ms 49724 KB Output is correct
3 Correct 13 ms 50000 KB Output is correct
4 Correct 226 ms 95248 KB Output is correct
5 Correct 187 ms 95300 KB Output is correct
6 Correct 190 ms 95408 KB Output is correct
7 Correct 142 ms 87252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 49488 KB Output is correct
2 Correct 12 ms 49488 KB Output is correct
3 Correct 10 ms 49500 KB Output is correct
4 Correct 13 ms 49500 KB Output is correct
5 Correct 10 ms 49500 KB Output is correct
6 Correct 13 ms 49500 KB Output is correct
7 Correct 11 ms 49756 KB Output is correct
8 Correct 16 ms 49756 KB Output is correct
9 Correct 15 ms 49756 KB Output is correct
10 Correct 12 ms 49756 KB Output is correct
11 Correct 11 ms 49756 KB Output is correct
12 Correct 15 ms 49756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49500 KB Output is correct
2 Correct 10 ms 49500 KB Output is correct
3 Correct 15 ms 50012 KB Output is correct
4 Correct 40 ms 53568 KB Output is correct
5 Correct 56 ms 53444 KB Output is correct
6 Correct 276 ms 95660 KB Output is correct
7 Correct 461 ms 92336 KB Output is correct
8 Correct 288 ms 95676 KB Output is correct
9 Correct 444 ms 92340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 49488 KB Output is correct
2 Correct 10 ms 49724 KB Output is correct
3 Correct 13 ms 50000 KB Output is correct
4 Correct 226 ms 95248 KB Output is correct
5 Correct 187 ms 95300 KB Output is correct
6 Correct 190 ms 95408 KB Output is correct
7 Correct 142 ms 87252 KB Output is correct
8 Correct 13 ms 49488 KB Output is correct
9 Correct 12 ms 49488 KB Output is correct
10 Correct 10 ms 49500 KB Output is correct
11 Correct 13 ms 49500 KB Output is correct
12 Correct 10 ms 49500 KB Output is correct
13 Correct 13 ms 49500 KB Output is correct
14 Correct 11 ms 49756 KB Output is correct
15 Correct 16 ms 49756 KB Output is correct
16 Correct 15 ms 49756 KB Output is correct
17 Correct 12 ms 49756 KB Output is correct
18 Correct 11 ms 49756 KB Output is correct
19 Correct 15 ms 49756 KB Output is correct
20 Correct 8 ms 49500 KB Output is correct
21 Correct 10 ms 49500 KB Output is correct
22 Correct 15 ms 50012 KB Output is correct
23 Correct 40 ms 53568 KB Output is correct
24 Correct 56 ms 53444 KB Output is correct
25 Correct 276 ms 95660 KB Output is correct
26 Correct 461 ms 92336 KB Output is correct
27 Correct 288 ms 95676 KB Output is correct
28 Correct 444 ms 92340 KB Output is correct
29 Correct 220 ms 64328 KB Output is correct
30 Correct 205 ms 61700 KB Output is correct
31 Correct 251 ms 65252 KB Output is correct
32 Correct 174 ms 64320 KB Output is correct
33 Correct 184 ms 61768 KB Output is correct
34 Correct 196 ms 65116 KB Output is correct
35 Correct 258 ms 65252 KB Output is correct
36 Correct 206 ms 65232 KB Output is correct
37 Correct 224 ms 65084 KB Output is correct
38 Correct 172 ms 65408 KB Output is correct