QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218016#7121. Beech Treehocky#0 36ms32264kbC++14829b2023-10-17 17:22:422023-10-17 17:22:43

Judging History

你现在查看的是测评时间为 2023-10-17 17:22:43 的历史记录

  • [2024-04-28 07:53:57]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:39ms
  • 内存:32072kb
  • [2023-10-17 17:22:43]
  • 评测
  • 测评结果:0
  • 用时:36ms
  • 内存:32264kb
  • [2023-10-17 17:22:42]
  • 提交

answer

#include "beechtree.h"
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i = a;i < b;i++)
#define trav(nx, v) for(auto &nx: v)
#define sz(v) (int) v.size()
#define all(v) begin(v), end(v)
#define pb push_back
#define fi first
#define se second
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int LIM = 200000;
typedef int LL;
vector <int> edge[LIM + 5];
LL warna[LIM + 5];
vector <int> ans;

LL dfs(LL pos){
	LL can = warna[pos];
	trav(nx, edge[pos]){
		auto nxColor = dfs(nx);
		if(nxColor != warna[pos]) can = -1;
	}
	if(can != -1) ans[pos] = 1;
	return can;
}

std::vector<int> beechtree(int N, int M, std::vector<int> P, std::vector<int> C){
	rep(i,1,N){
		edge[P[i]].pb(i);
	}
	rep(i,0,N){
		warna[i] = C[i];
	}
	ans.resize(N);
	dfs(0);
	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: 1ms
memory: 9228kb

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: 36ms
memory: 32264kb

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: 16ms
memory: 11740kb

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: 34ms
memory: 16380kb

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 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 ...

result:

wrong answer 2nd lines differ - on the 12th 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: 8728kb

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%