Submission #931810

# Submission time Handle Problem Language Result Execution time Memory
931810 2024-02-22T11:12:54 Z Syrius Topical (NOI23_topical) C++14
12 / 100
474 ms 31856 KB
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define ll long long
#define ff first
#define ss second
#define pint pair < int , int >
#define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL)

const int inf = 1e9 + 9;
const int mxn = 2e5 + 2;
const int mod = 1e9 + 7;

vector < vector < int > > u , r;
int n , k;

bool cmp(vector < int > a , vector < int > b) {
    for (int i = 0; i < k; i++) {
        if (a[i] < b[i]) return 1;
        else if (a[i] > b[i]) return 0;
    }
    return 0;
}

int main() {

    cin >> n >> k;

    for (int i = 0; i < n; i++) {
        vector < int > tv;
        for (int j = 0; j < k; j++) {
            int t;
            cin >> t;
            tv.push_back(t);
        }
        tv.push_back(i);
        r.push_back(tv);
    }

    u.resize(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < k; j++) {
            int t;
            cin >> t;
            u[i].push_back(t);
        }
    }

    sort(r.begin() , r.end() , cmp);
    vector < int > p(k , 0);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!cmp(p , r[i])) {
            ans++;
            for (int j = 0; j < k; j++) {
                p[j] += u[r[i][k]][j];
            }
        } else break;
    }

    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 376 KB Output is correct
3 Correct 5 ms 720 KB Output is correct
4 Correct 474 ms 31856 KB Output is correct
5 Correct 433 ms 31812 KB Output is correct
6 Correct 440 ms 31692 KB Output is correct
7 Correct 274 ms 25964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 388 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 6 ms 856 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 13 ms 1712 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 376 KB Output is correct
3 Correct 5 ms 720 KB Output is correct
4 Correct 474 ms 31856 KB Output is correct
5 Correct 433 ms 31812 KB Output is correct
6 Correct 440 ms 31692 KB Output is correct
7 Correct 274 ms 25964 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 388 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Incorrect 6 ms 856 KB Output isn't correct
15 Halted 0 ms 0 KB -