Submission #809631

# Submission time Handle Problem Language Result Execution time Memory
809631 2023-08-06T02:41:04 Z PixelCat Comparing Plants (IOI20_plants) C++14
11 / 100
60 ms 7756 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 = 300;
 
vector<int> adj[MAXN + 10];
int vis[MAXN + 10];
bitset<MAXN + 10> tal[MAXN + 10];
 
int dist(int s, int t, int n) {
    if(s <= t) return t - s;
    else return t - s + n;
}
 
void dp(int n) {
    if(vis[n]) return;
    vis[n] = 1;
    tal[n].reset();
    for(auto &i:adj[n]) {
        dp(i);
        tal[n] |= tal[i];
        tal[n][i] = 1;
    }
}
 
void init(int k, vector<int> r) {
    int n = sz(r);
    vector<int> alive(n, 1);
    int cnt = n;
    while(cnt > 0) {
        int idx = -1, last = -1;
        For(_, 0, 1) For(i, 0, n - 1) if(alive[i] && r[i] == 0) {
            if(idx < 0 || dist(last, i, n) >= k) idx = i;
            last = i;
        }
        // cerr << idx << "\n";
        // For(i, 0, n - 1) cerr << r[i] << " \n"[i == n - 1];
        For(i, n - k + 1, n - 1) {
            int le = (idx + i) % n;
            if(alive[le]) {
                r[le]--;
                adj[le].eb(idx);
            } else {
                adj[idx].eb(le);
            }
        }
        alive[idx] = 0;
        cnt--;
    }
    memset(vis, 0, sizeof(vis));
    For(i, 0, n - 1) dp(i);
}
 
int compare_plants(int x, int y) {
    if(tal[y][x]) return 1;
    if(tal[x][y]) return -1;
    return 0;
}
# 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 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 60 ms 3040 KB Output is correct
7 Runtime error 33 ms 7756 KB Execution killed with signal 11
8 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 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Runtime error 4 ms 672 KB Execution killed with signal 6
7 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 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Runtime error 4 ms 672 KB Execution killed with signal 6
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 41 ms 5776 KB Execution killed with signal 11
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 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 15 ms 1276 KB Output is correct
8 Correct 16 ms 1540 KB Output is correct
9 Correct 15 ms 1184 KB Output is correct
10 Correct 12 ms 1448 KB Output is correct
11 Correct 12 ms 1176 KB Output is correct
12 Correct 15 ms 1276 KB Output is correct
13 Correct 13 ms 1912 KB Output is correct
# 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 Correct 0 ms 212 KB Output is correct
5 Runtime error 1 ms 468 KB Execution killed with signal 11
6 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 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 60 ms 3040 KB Output is correct
7 Runtime error 33 ms 7756 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -