Submission #893317

# Submission time Handle Problem Language Result Execution time Memory
893317 2023-12-27T01:43:17 Z vjudge1 Topical (NOI23_topical) C++17
40 / 100
1000 ms 178700 KB
#include <bits/stdc++.h>
#define task ""
#define ff first
#define ss second
using namespace std;
using ld = long double;
using ull = unsigned long long;
using ll = long long;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
const char el = '\n';
const char sp = ' ';
const ll inf = 1e9; //1e18;
const ll maxN = 1e6 + 1;
int n, m;
int l[maxN], cnt[maxN];
ll p[maxN];
vector <vector <ll>> a, b;
vector <vector <pll>> c;
set <pii> s;

int main ()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen(task".inp", "r", stdin);
//    freopen(task".out", "w", stdout);
    cin >> n >> m;
    a.resize(n, vector <ll> (m));
    b.resize(n, vector <ll> (m));
    for (int i = 0;i < n;++i)
        for (int j = 0;j < m;++j)
            cin >> a[i][j];
    for (int i = 0;i < n;++i)
        for (int j = 0;j < m;++j)
            cin >> b[i][j];
    c.resize(m, vector <pll> (n));
    for (int j = 0;j < m;++j)
    {
        l[j] = 0;
        for (int i = 0;i < n;++i)
            c[j][i] = {a[i][j], i};
        sort(c[j].begin(), c[j].end());
    }
    for (int i = 0;i < n;++i)
        s.insert({0, i}), cnt[i] = 0;
    while(!s.empty())
    {
        for (int j = 0;j < m;++j)
        {
            while(l[j] < n && c[j][l[j]].ff <= p[j])
            {
                int ii = c[j][l[j]].ss;
                s.erase({cnt[ii], ii});
                cnt[ii]++;
                s.insert({cnt[ii], ii});
                l[j]++;
            }
        }
        auto it = *s.rbegin();
        if (it.ff != m) break;
        s.erase(it);
        int i = it.ss;
        for (int j = 0;j < m;++j)
            p[j] += b[i][j];
    }
    cout << n - (ll)s.size();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 3 ms 5212 KB Output is correct
4 Correct 191 ms 84336 KB Output is correct
5 Correct 196 ms 84360 KB Output is correct
6 Correct 199 ms 84352 KB Output is correct
7 Correct 136 ms 77960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4600 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 3 ms 4700 KB Output is correct
8 Correct 3 ms 4700 KB Output is correct
9 Correct 3 ms 4764 KB Output is correct
10 Correct 3 ms 4700 KB Output is correct
11 Correct 3 ms 4700 KB Output is correct
12 Correct 3 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 8 ms 6076 KB Output is correct
4 Correct 80 ms 21560 KB Output is correct
5 Correct 74 ms 21648 KB Output is correct
6 Execution timed out 1074 ms 178700 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 3 ms 5212 KB Output is correct
4 Correct 191 ms 84336 KB Output is correct
5 Correct 196 ms 84360 KB Output is correct
6 Correct 199 ms 84352 KB Output is correct
7 Correct 136 ms 77960 KB Output is correct
8 Correct 1 ms 4600 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 3 ms 4700 KB Output is correct
15 Correct 3 ms 4700 KB Output is correct
16 Correct 3 ms 4764 KB Output is correct
17 Correct 3 ms 4700 KB Output is correct
18 Correct 3 ms 4700 KB Output is correct
19 Correct 3 ms 4700 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 8 ms 6076 KB Output is correct
23 Correct 80 ms 21560 KB Output is correct
24 Correct 74 ms 21648 KB Output is correct
25 Execution timed out 1074 ms 178700 KB Time limit exceeded
26 Halted 0 ms 0 KB -