Submission #1088006

# Submission time Handle Problem Language Result Execution time Memory
1088006 2024-09-13T16:58:42 Z Valaki2 Beech Tree (IOI23_beechtree) C++17
5 / 100
61 ms 20132 KB
#include "beechtree.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

const int maxn = 2e5;

int n, k;
vector<int> g[maxn];
int par[maxn];
int col[maxn];
int ans[maxn];

void solve() {
    for(int i = n - 2; i >= 0; i--) {
        if(i != 0) if(col[i] != col[i + 1]) {
            ans[i - 1] = 0;
        }
        if(ans[i + 1] == 0) {
            ans[i] = 0;
        }
    }
}

vector<int> beechtree(int N, int M, vector<int> P, vector<int> C)
{
    n = N, k = M;
    for(int i = 0; i < n; i++) {
        par[i] = P[i];
        col[i] = C[i];
        if(i > 0) {
            g[par[i]].pb(i);
        }
        ans[i] = 1;
    }
    solve();
    vector<int> answer(n);
    for(int i = 0; i < n; i++) {
        answer[i] = ans[i];
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4952 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 2 ms 5100 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Incorrect 3 ms 5208 KB 2nd lines differ - on the 1st token, expected: '0', found: '1'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 2 ms 5100 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 61 ms 20132 KB Output is correct
8 Correct 50 ms 20092 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 5136 KB Output is correct
13 Correct 3 ms 5212 KB Output is correct
14 Correct 3 ms 5212 KB Output is correct
15 Correct 2 ms 5208 KB Output is correct
16 Correct 3 ms 5212 KB Output is correct
17 Correct 48 ms 19864 KB Output is correct
18 Correct 51 ms 20048 KB Output is correct
19 Correct 50 ms 20012 KB Output is correct
20 Correct 52 ms 20060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4956 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 2 ms 5100 KB Output is correct
3 Incorrect 3 ms 5208 KB 2nd lines differ - on the 1st token, expected: '0', found: '1'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4952 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 2 ms 5100 KB Output is correct
3 Incorrect 3 ms 5208 KB 2nd lines differ - on the 1st token, expected: '0', found: '1'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4952 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 2 ms 5100 KB Output is correct
3 Incorrect 3 ms 5208 KB 2nd lines differ - on the 1st token, expected: '0', found: '1'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4952 KB 2nd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -