QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#428814 | #6335. Belt Conveyor | Rafi22# | 1 | 332ms | 31380kb | C++20 | 1.8kb | 2024-06-01 21:58:21 | 2024-06-01 21:58:22 |
Judging History
answer
#include "conveyor.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
const int N=100007;
vector<pair<int,int>>G[N];
bool dead[N],odw[N];
bool is[N];
vector<int>ans;
vector<int>X,Y;
vector<int>V0,V1;
void dfs(int v,int o,int c)
{
//cout<<"XDDD "<<v<<endl;
odw[v]=1;
if(c==0) V0.pb(v);
else V1.pb(v);
for(auto [u,k]:G[v])
{
if(dead[u])
{
if(k>0) X[k-1]=1;
else X[-k-1]=0;
}
if(odw[u]||dead[u]) continue;
X[abs(k)-1]=rand()%2;
dfs(u,v,c^1);
}
}
void Solve(int n,vector<int>A,vector<int>B)
{
X.resize(n-1,0);
Y.resize(n,0);
ans.resize(n-1);
for(int i=1;i<=n-1;i++)
{
G[A[i-1]].pb({B[i-1],i});
G[B[i-1]].pb({A[i-1],-i});
}
while(true)
{
memset(odw,0,sizeof odw);
for(int i=0;i<n;i++) Y[i]=0;
for(int i=0;i<n-1;i++) X[i]=0;
for(int i=0;i<n;i++)
{
if(dead[i]||odw[i]) continue;
V0.clear(),V1.clear();
dfs(i,0,0);
if(sz(V1)>sz(V0)) swap(V1,V0);
for(auto x:V0) Y[x]=1;
}
/* cout<<"Q"<<" "<<xd<<endl;
for(auto x:X) cout<<x<<" ";
cout<<endl;
for(auto x:Y) cout<<x<<" ";
cout<<endl;*/
vector<int>Z=Query(X,Y);
//for(auto x:Z) cout<<x<<" ";
// cout<<endl;
for(int i=0;i<n;i++)
{
if(Y[i]&&Z[i])
{
//cout<<"KILL "<<i<<endl;
for(auto [u,k]:G[i])
{
if(!dead[u])
{
if(k>0) ans[k-1]=X[k-1]^1;
else ans[-k-1]=X[-k-1];
is[abs(k)-1]=1;
}
}
dead[i]=1;
}
}
bool xd=1;
for(int i=0;i<n-1;i++) xd&=is[i];
if(xd) break;
}
//for(auto x:ans) cout<<x<<" ";
// cout<<endl;
Answer(ans);
}
详细
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 3944kb
input:
random1 2 0 1 1 0xC321A02965AC2640
output:
Accepted: 2
result:
ok correct
Test #2:
score: 1
Accepted
time: 1ms
memory: 4232kb
input:
random1 2 1 0 0 0x8A99AD9552B2C218
output:
Accepted: 2
result:
ok correct
Test #3:
score: 1
Accepted
time: 1ms
memory: 3912kb
input:
random1 2 1 0 1 0x024D21FA307D148D
output:
Accepted: 1
result:
ok correct
Test #4:
score: 1
Accepted
time: 1ms
memory: 3936kb
input:
random1 2 0 1 0 0x3C96AB23CEB63F75
output:
Accepted: 1
result:
ok correct
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3936kb
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 [5]
result:
wrong answer Token "Wrong" doesn't correspond to pattern "Accepted:"
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 332ms
memory: 31380kb
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:
Wrong Answer [5]
result:
wrong answer Token "Wrong" doesn't correspond to pattern "Accepted:"
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%