Submission #600876

# Submission time Handle Problem Language Result Execution time Memory
600876 2022-07-21T08:42:52 Z PiejanVDC Comparing Plants (IOI20_plants) C++17
5 / 100
94 ms 9476 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>l(200005),h(200005), R;
int N;

void init(int k, vector<int>r) {
    R = r;
    N = r.size();
    for(int i = 1 ; i < N ; i++) {
        if(r[i-1]) {
            h[i] = h[i-1];
            l[i] = i;
        } else {
            h[i] = i;
            l[i] = l[i-1];
        }
    }
}

int compare_plants(int x, int y) {
    if(h[y] == h[x])
        return -1;
    if(l[y] == l[x])
        return 1;
    if(h[N-1] == h[y] && h[x] == h[0] && R[N-1])
        return 1;
    if(l[N-1] == l[y] && l[x] == l[0] && !R[N-1])
        return -1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 60 ms 5664 KB Output is correct
7 Correct 57 ms 6972 KB Output is correct
8 Correct 78 ms 9476 KB Output is correct
9 Correct 83 ms 9468 KB Output is correct
10 Correct 79 ms 9452 KB Output is correct
11 Correct 80 ms 9476 KB Output is correct
12 Correct 68 ms 9424 KB Output is correct
13 Correct 94 ms 9420 KB Output is correct
14 Correct 73 ms 9472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Incorrect 1 ms 1876 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Incorrect 1 ms 1876 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Incorrect 1 ms 1876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Incorrect 1 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1896 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 2 ms 1876 KB Output is correct
4 Incorrect 1 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 60 ms 5664 KB Output is correct
7 Correct 57 ms 6972 KB Output is correct
8 Correct 78 ms 9476 KB Output is correct
9 Correct 83 ms 9468 KB Output is correct
10 Correct 79 ms 9452 KB Output is correct
11 Correct 80 ms 9476 KB Output is correct
12 Correct 68 ms 9424 KB Output is correct
13 Correct 94 ms 9420 KB Output is correct
14 Correct 73 ms 9472 KB Output is correct
15 Correct 1 ms 1876 KB Output is correct
16 Correct 1 ms 1876 KB Output is correct
17 Incorrect 1 ms 1876 KB Output isn't correct
18 Halted 0 ms 0 KB -