Submission #357664

# Submission time Handle Problem Language Result Execution time Memory
357664 2021-01-24T11:34:05 Z doowey Comparing Plants (IOI20_plants) C++14
14 / 100
4000 ms 9708 KB
#include <bits/stdc++.h>
#include "plants.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define fi first
#define se scond
#define mp make_pair

const int N = (int)2e5 + 100;
int A[N];
int vl[N];

void init(int k, vector<int> r) {
    int n = r.size();
    for(int i = 0 ; i < n; i ++ ){
        if(r[i] == 0){
            for(int j = 1; j < k ; j ++ ){
                vl[(i + j) % n] ++ ;
            }
        }
    }
    int pv;
    for(int id = n - 1; id >= 0; id -- ){
        for(int q = 0; q < n; q ++ ){
            if(vl[q] == 0 && r[q] == 0){
                A[q] = id;
                for(int j = 0; j < k ; j ++ ){
                    pv = (q - j + n) % n;
                    r[pv] -- ;
                    if(r[pv] == 0){
                        for(int z = 1; z < k ; z ++ ){
                            vl[(pv + z) % n] ++ ;
                        }
                    }
                    vl[(q + j) % n] -- ;
                }
                break;
            }
        }
    }
}

int compare_plants(int x, int y) {
    if(A[x] < A[y]) return -1;
    return +1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 0 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 16 ms 492 KB Output is correct
7 Correct 414 ms 5100 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 16 ms 492 KB Output is correct
10 Correct 408 ms 5228 KB Output is correct
11 Correct 272 ms 5228 KB Output is correct
12 Correct 273 ms 5228 KB Output is correct
13 Correct 500 ms 5172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 16 ms 492 KB Output is correct
7 Correct 414 ms 5100 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 16 ms 492 KB Output is correct
10 Correct 408 ms 5228 KB Output is correct
11 Correct 272 ms 5228 KB Output is correct
12 Correct 273 ms 5228 KB Output is correct
13 Correct 500 ms 5172 KB Output is correct
14 Correct 3899 ms 5800 KB Output is correct
15 Execution timed out 4046 ms 9708 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 268 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 71 ms 3180 KB Output is correct
4 Execution timed out 4070 ms 8172 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 0 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 0 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -