Submission #800242

# Submission time Handle Problem Language Result Execution time Memory
800242 2023-08-01T12:41:02 Z PixelCat Comparing Plants (IOI20_plants) C++14
14 / 100
228 ms 5556 KB
#include "plants.h"

#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;

const int MAXN = 5000;

int rk[MAXN + 10];

int dist(int s, int t, int n) {
    if(s <= t) return t - s;
    else return t - s + n;
}

void init(int k, vector<int> r) {
    int n = sz(r);
    vector<int> alive(n, 1);
    int cnt = n;
    int rank = 0;
    while(cnt > 0) {
        rank++;
        int idx = -1;
        For(_, 0, 1) For(i, 0, n - 1) if(alive[i]) {
            if(r[i] == 0 && (idx < 0 || dist(idx, i, n) >= k)) idx = i;
        }
        // cerr << idx << "\n";
        // For(i, 0, n - 1) cerr << r[i] << " \n"[i == n - 1];
        rk[idx] = rank;
        For(i, n - k + 1, n - 1) r[(idx + i) % n]--;
        alive[idx] = 0;
        cnt--;
    }
}

int compare_plants(int x, int y) {
    if(rk[x] < rk[y]) return 1;
    return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 340 KB Output is correct
7 Correct 221 ms 3104 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 8 ms 372 KB Output is correct
10 Correct 200 ms 3112 KB Output is correct
11 Correct 157 ms 3068 KB Output is correct
12 Correct 138 ms 3320 KB Output is correct
13 Correct 228 ms 3108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 340 KB Output is correct
7 Correct 221 ms 3104 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 8 ms 372 KB Output is correct
10 Correct 200 ms 3112 KB Output is correct
11 Correct 157 ms 3068 KB Output is correct
12 Correct 138 ms 3320 KB Output is correct
13 Correct 228 ms 3108 KB Output is correct
14 Runtime error 29 ms 5556 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 56 ms 3172 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -