QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#484595 | #6335. Belt Conveyor | Unforgettablepl | 11 | 74ms | 34600kb | C++20 | 1.4kb | 2024-07-19 20:20:48 | 2024-07-19 20:20:48 |
Judging History
answer
#include "conveyor.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int N, vector<int> A, vector<int> B) {
vector<vector<pair<int,int>>> adj(N);
for(int i=0;i<N-1;i++){
adj[A[i]].emplace_back(B[i],i);
adj[B[i]].emplace_back(A[i],i);
}
vector<pair<int,int>> p(N);
function<void(int,int)> dfs = [&](int x,int par){
for(auto[v,i]:adj[x]){
if(v==par)p[x]={v,i};
else dfs(v,x);
}
};
dfs(0,0);
vector<int> ans(N-1);
vector<bool> vis(N);
vis[0]=true;
for(int offset=0;offset<3;offset++){
for(int moves=0;moves<2;moves++){
vector<int> buffer;
for(int i=offset;i<N;i+=3)if(!vis[i])buffer.emplace_back(i);
vector<int> directions(N-1),products(N);
for(int&v:buffer){
products[v]=1;
for(auto[child,idx]:adj[v]){
if(child==p[v].first)continue;
if(!vis[child])continue;
if(A[idx]==v and ans[idx]==0)directions[idx]=1;
if(B[idx]==v and ans[idx]==1)directions[idx]=1;
}
}
auto t = Query(directions,products);
for(int&v:buffer){
if(t[v]){
vis[v]=true;
int idx = p[v].second;
if(A[idx]==v)ans[idx]=1;
} else if(t[p[v].first]){
vis[v]=true;
int idx = p[v].second;
if(B[idx]==v)ans[idx]=1;
} else {
int impacted = v+1;
if(t[impacted]==0)continue;
int idx = p[impacted].second;
vis[impacted]=true;
if(A[idx]==impacted)ans[idx]=1;
}
}
}
}
Answer(ans);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 0ms
memory: 3840kb
input:
random1 2 0 1 1 0xC321A02965AC2640
output:
Accepted: 6
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
random1 2 1 0 0 0x8A99AD9552B2C218
output:
Accepted: 6
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
random1 2 1 0 1 0x024D21FA307D148D
output:
Accepted: 6
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
random1 2 0 1 0 0x3C96AB23CEB63F75
output:
Accepted: 6
result:
ok correct
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3736kb
input:
priority 30 10 29 10 13 17 11 2 15 15 27 9 26 18 0 14 1 22 24 29 28 6 22 4 20 15 5 28 4 21 24 3 13 1 8 13 12 8 19 16 3 1 10 24 29 12 8 4 7 2 7 28 25 12 7 2 23 27 22 89058848 6377689 24189123 31671827 205117644 254374430 56016068 6819602 212866321 246625321 274047319 230485311 202854776 280075001 203...
output:
Wrong Answer [8]
result:
wrong answer Token "Wrong" doesn't correspond to pattern "Accepted:"
Subtask #3:
score: 10
Accepted
Test #11:
score: 10
Accepted
time: 72ms
memory: 33108kb
input:
random1 100000 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 89 90 91 92 93 94 95 96 97 9...
output:
Accepted: 6
result:
ok correct
Test #12:
score: 0
Accepted
time: 74ms
memory: 33196kb
input:
priority 100000 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 89 90 91 92 93 94 95 96 97 ...
output:
Accepted: 6
result:
ok correct
Test #13:
score: 0
Accepted
time: 43ms
memory: 34600kb
input:
random1 100000 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 89 90 91 92 93 94 95 96 97 9...
output:
Accepted: 6
result:
ok correct
Test #14:
score: 0
Accepted
time: 56ms
memory: 33196kb
input:
priority 100000 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 89 90 91 92 93 94 95 96 97 ...
output:
Accepted: 6
result:
ok correct
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%