QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#769037 | #6335. Belt Conveyor | 275307894a | 11 | 150ms | 35332kb | C++17 | 2.2kb | 2024-11-21 15:52:27 | 2024-11-21 15:52:27 |
Judging History
answer
#include "conveyor.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e5+5,M=N*4+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,X[N],Y[N],vis[N];
vector<int> S[N],st[3];
int d[N];
void make(int x,int La){
int flag=0;
for(int i:S[x]) if(int y=X[i]^Y[i]^x;flag|=(vis[i]==-1),y^La){
d[y]=(d[x]+1+(vis[i]!=-1))%3;
make(y,x);
}
if(flag) st[d[x]].push_back(x);
if(La){
rotate(S[x].begin(),find(all(S[x]),La),S[x].end());
reverse(all(S[x]));
}
}
void Solve(int nn, vector<int> A, vector<int> B) {
n=nn;
for(int i=0;i<n-1;i++) X[i]=A[i],Y[i]=B[i],vis[i]=-1;
for(int i=0;i<n-1;i++){
S[A[i]].push_back(i);
S[B[i]].push_back(i);
}
while(1){
if(find(vis,vis+n-1,-1)==vis+n-1) break;
for(int o:{0,1,2}) st[o].clear();
make(0,0);
int mx=0;for(int o:{0,1,2}) if(st[o].size()>st[mx].size()) mx=o;
vector<int> x(n-1),y(n);
for(int i:st[mx]) y[i]=1;
for(int i=0;i<n-1;i++)if(~vis[i]){
if(y[X[i]]) x[i]=vis[i]^1;
if(y[Y[i]]) x[i]=vis[i];
}
vector<int> z=Query(x,y);
gdb(1);
for(int i:st[mx]){
if(z[i]){
for(int j:S[i]) if(vis[j]==-1) vis[j]=(i==X[j]);
}else{
for(int j:S[i]) if(int v=i^X[j]^Y[j];vis[j]==-1&&z[v]){ vis[j]=(i==Y[j]),gdb(j);break;}
}
}
}
for(int i=0;i<n-1;i++) gdb(vis[i]);
Answer({vis,vis+n-1});
}
詳細信息
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 7284kb
input:
random1 2 0 1 1 0xC321A02965AC2640
output:
Accepted: 1
result:
ok correct
Test #2:
score: 1
Accepted
time: 1ms
memory: 6728kb
input:
random1 2 1 0 0 0x8A99AD9552B2C218
output:
Accepted: 1
result:
ok correct
Test #3:
score: 1
Accepted
time: 1ms
memory: 6348kb
input:
random1 2 1 0 1 0x024D21FA307D148D
output:
Accepted: 1
result:
ok correct
Test #4:
score: 1
Accepted
time: 0ms
memory: 6184kb
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: 1ms
memory: 6672kb
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: 10
Accepted
Test #11:
score: 10
Accepted
time: 150ms
memory: 33684kb
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: 11
result:
ok correct
Test #12:
score: 10
Accepted
time: 143ms
memory: 33728kb
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: 11
result:
ok correct
Test #13:
score: 10
Accepted
time: 119ms
memory: 35332kb
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: 11
result:
ok correct
Test #14:
score: 10
Accepted
time: 146ms
memory: 33760kb
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: 11
result:
ok correct
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%