QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#531097 | #7121. Beech Tree | green_gold_dog# | 0 | 42ms | 18228kb | C++20 | 879b | 2024-08-24 18:20:56 | 2024-08-24 18:20:57 |
Judging History
answer
#include "beechtree.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
vector<ll> beechtree(ll n, ll m, vector<ll> p, vector<ll> c) {
vector<vector<ll>> sons(n);
for (ll i = 1; i < n; i++) {
sons[p[i]].push_back(i);
}
vector<ll> ans(n, 0);
ans[n - 1] = 1;
for (ll i = n - 2; i >= 0; i--) {
if (c[i] != c[i + 1]) {
break;
}
ans[i] = 1;
}
return ans;
for (ll i = 0; i < n; i++) {
set<tuple<ll, ll, ll>> s;
s.insert(make_tuple(-((ll)sons[i].size()), -1, i));
bool b = true;
map<ll, ll> ncol;
ll nnum = 0;
while (!s.empty()) {
auto[_, need, i] = *s.begin();
s.erase(s.begin());
if (need != -1) {
if (ncol[c[i]] != need) {
b = false;
break;
}
ncol[c[i]]++;
}
for (auto j : sons[i]) {
s.emplace(-((ll)sons[j].size()), nnum, j);
}
nnum++;
}
if (b) {
ans[i] = 1;
}
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3768kb
input:
j2DRV0nYbs0y1xUYUGaiqtOKUU9vM9zi 8 500 -1 0 1 2 3 4 5 6 0 281 281 281 281 281 281 281
output:
p89vHUOQJ7iyHtdrgGXzKx8iRtXLL6wH OK 0 1 1 1 1 1 1 1
result:
wrong answer 2nd lines differ - on the 1st token, expected: '1', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 35ms
memory: 18228kb
input:
j2DRV0nYbs0y1xUYUGaiqtOKUU9vM9zi 200000 200000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86...
output:
p89vHUOQJ7iyHtdrgGXzKx8iRtXLL6wH OK 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 2nd lines differ - on the 199999th token, expected: '1', found: '0'
Subtask #3:
score: 0
Wrong Answer
Test #25:
score: 0
Wrong Answer
time: 14ms
memory: 8320kb
input:
j2DRV0nYbs0y1xUYUGaiqtOKUU9vM9zi 103965 200000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
p89vHUOQJ7iyHtdrgGXzKx8iRtXLL6wH OK 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 2nd lines differ - on the 2nd token, expected: '1', found: '0'
Subtask #4:
score: 0
Wrong Answer
Test #48:
score: 0
Wrong Answer
time: 42ms
memory: 13852kb
input:
j2DRV0nYbs0y1xUYUGaiqtOKUU9vM9zi 199979 200000 -1 0 1 1 1 1 1 1 1 1 1 1 11 11 1 11 11 11 11 11 11 11 0 22 23 23 23 23 23 23 23 23 23 23 33 22 35 36 36 36 36 36 36 36 36 38 38 38 35 48 49 49 49 49 49 49 49 53 53 48 59 60 60 60 60 60 59 66 67 67 67 67 67 67 67 67 67 67 73 71 66 80 81 81 81 81 81 81 81...
output:
p89vHUOQJ7iyHtdrgGXzKx8iRtXLL6wH OK 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 2nd lines differ - on the 3rd token, expected: '1', found: '0'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Wrong Answer
Test #65:
score: 0
Wrong Answer
time: 0ms
memory: 3912kb
input:
j2DRV0nYbs0y1xUYUGaiqtOKUU9vM9zi 2000 2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 ...
output:
p89vHUOQJ7iyHtdrgGXzKx8iRtXLL6wH OK 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
wrong answer 2nd lines differ - on the 1st token, expected: '1', found: '0'
Subtask #7:
score: 0
Skipped
Dependency #5:
0%
Subtask #8:
score: 0
Skipped
Dependency #6:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
0%