답안 #1102379

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102379 2024-10-18T03:27:16 Z HiepVu217 Topical (NOI23_topical) C++17
100 / 100
317 ms 94388 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 17;
int n, k, id[N], ex[N], p[N], ans;
vector <pair <int, int>> r[N];
vector <int> u[N], md;
int main()
{
    ios_base::sync_with_stdio(0);
    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 ({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);
        }
    }
    while (1)
    {
        for (int i = 1; i <= k; ++i)
        {
            while (id[i] < n && p[i] >= r[i][id[i]].first)
            {
                int _ = r[i][id[i]].second;
                ++ex[_], ++id[i];
                if (ex[_] == k)
                {
                    md.push_back(_);
                }
            }
        }
        if (!md.size())
        {
            break;
        }
        ans += int (md.size());
        for (int i: md)
        {
            for (int j = 0; j < k; ++j)
            {
                p[j + 1] += u[i][j];
            }
        }
        md.clear();
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 47696 KB Output is correct
2 Correct 9 ms 47696 KB Output is correct
3 Correct 10 ms 48208 KB Output is correct
4 Correct 161 ms 90548 KB Output is correct
5 Correct 172 ms 90796 KB Output is correct
6 Correct 171 ms 90560 KB Output is correct
7 Correct 132 ms 85276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 47696 KB Output is correct
2 Correct 9 ms 47696 KB Output is correct
3 Correct 9 ms 47696 KB Output is correct
4 Correct 10 ms 47796 KB Output is correct
5 Correct 8 ms 47696 KB Output is correct
6 Correct 9 ms 47696 KB Output is correct
7 Correct 10 ms 48024 KB Output is correct
8 Correct 10 ms 48024 KB Output is correct
9 Correct 10 ms 47952 KB Output is correct
10 Correct 11 ms 47952 KB Output is correct
11 Correct 11 ms 47952 KB Output is correct
12 Correct 11 ms 48020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 47696 KB Output is correct
2 Correct 8 ms 47696 KB Output is correct
3 Correct 11 ms 48380 KB Output is correct
4 Correct 36 ms 52172 KB Output is correct
5 Correct 44 ms 52084 KB Output is correct
6 Correct 292 ms 94388 KB Output is correct
7 Correct 302 ms 91056 KB Output is correct
8 Correct 285 ms 94384 KB Output is correct
9 Correct 317 ms 91056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 47696 KB Output is correct
2 Correct 9 ms 47696 KB Output is correct
3 Correct 10 ms 48208 KB Output is correct
4 Correct 161 ms 90548 KB Output is correct
5 Correct 172 ms 90796 KB Output is correct
6 Correct 171 ms 90560 KB Output is correct
7 Correct 132 ms 85276 KB Output is correct
8 Correct 9 ms 47696 KB Output is correct
9 Correct 9 ms 47696 KB Output is correct
10 Correct 9 ms 47696 KB Output is correct
11 Correct 10 ms 47796 KB Output is correct
12 Correct 8 ms 47696 KB Output is correct
13 Correct 9 ms 47696 KB Output is correct
14 Correct 10 ms 48024 KB Output is correct
15 Correct 10 ms 48024 KB Output is correct
16 Correct 10 ms 47952 KB Output is correct
17 Correct 11 ms 47952 KB Output is correct
18 Correct 11 ms 47952 KB Output is correct
19 Correct 11 ms 48020 KB Output is correct
20 Correct 9 ms 47696 KB Output is correct
21 Correct 8 ms 47696 KB Output is correct
22 Correct 11 ms 48380 KB Output is correct
23 Correct 36 ms 52172 KB Output is correct
24 Correct 44 ms 52084 KB Output is correct
25 Correct 292 ms 94388 KB Output is correct
26 Correct 302 ms 91056 KB Output is correct
27 Correct 285 ms 94384 KB Output is correct
28 Correct 317 ms 91056 KB Output is correct
29 Correct 196 ms 62472 KB Output is correct
30 Correct 212 ms 59860 KB Output is correct
31 Correct 248 ms 63728 KB Output is correct
32 Correct 159 ms 62536 KB Output is correct
33 Correct 170 ms 59736 KB Output is correct
34 Correct 183 ms 63304 KB Output is correct
35 Correct 222 ms 63796 KB Output is correct
36 Correct 189 ms 63304 KB Output is correct
37 Correct 204 ms 63300 KB Output is correct
38 Correct 155 ms 63976 KB Output is correct