Submission #932607

# Submission time Handle Problem Language Result Execution time Memory
932607 2024-02-23T21:31:50 Z EJIC_B_KEDAX Comparing Plants (IOI20_plants) C++17
14 / 100
4000 ms 9520 KB
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

const int N = 200200;
int level[N];

void init(int k, vector<int> r) {
    int n = r.size();
    int ok = 0, last = -k, lev = n, iter = 0;
    while (ok < n) {
        last = -k;
        for (int i = n - 1; i >= n - k; i--) {
            if (!r[i]) {
                last = i - n;
                break;
            }
        }
        vector<int> nw = r;
        for (int i = 0; i < n; i++) {
            if (!r[i]) {
                if (i - last >= k) {
                    level[i] = lev;
                    ok++;
                    for (int j = i - 1; j > i - k; j--) {
                        if (j >= 0) {
                            nw[j]--;
                        } else {
                            nw[j + n]--;
                        }
                    }
                    nw[i] = INT32_MAX / 2;
                }
                last = i;
            }
        }
        swap(nw, r);
        lev--;
        iter++;
        assert(iter < n + 10);
    }
}

int compare_plants(int x, int y) {
    if (level[x] < level[y]) {
        return -1;
    }
    return level[x] > level[y];
}
# 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 412 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 63 ms 5204 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 62 ms 5032 KB Output is correct
11 Correct 60 ms 4908 KB Output is correct
12 Correct 57 ms 5200 KB Output is correct
13 Correct 73 ms 5204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 412 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 63 ms 5204 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 62 ms 5032 KB Output is correct
11 Correct 60 ms 4908 KB Output is correct
12 Correct 57 ms 5200 KB Output is correct
13 Correct 73 ms 5204 KB Output is correct
14 Correct 356 ms 5552 KB Output is correct
15 Execution timed out 4041 ms 9520 KB Time limit exceeded
16 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 Correct 41 ms 5016 KB Output is correct
4 Execution timed out 4037 ms 8396 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 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 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -