QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84632 | #141. 8 染色 | Appleblue17 | 0 | 29ms | 22016kb | C++14 | 1.9kb | 2023-03-06 16:27:18 | 2023-03-06 16:27:20 |
Judging History
Alice
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
const int B=8;
namespace {
const int N=2e5+5;
vector <int> G[N];
int in[N];
queue <int> q;
vector <int> ANS;
}
std::vector <int> Alice(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> C) {
for(int i=0;i<m;i++){
int u=U[i]+1,v=V[i]+1;
G[u].push_back(v),G[v].push_back(u);
in[u]++,in[v]++;
}
for(int i=1;i<=n;i++){
if(in[i]<B) q.push(i);
}
while(q.size()){
int u=q.front(); q.pop();
for(int v: G[u]){
if(in[v]<B) continue;
in[v]--;
if(in[v]<B) q.push(v);
}
}
for(int i=1;i<=n;i++){
if(in[i]>=B){
for(int t=0;t<3;t++) ANS.push_back(C[i-1]>>t & 1);
}
}
// cout<<"Alice send: ";
// for(int x: ANS) cout<<x<<" ";
// cout<<'\n';
return ANS;
}
Bob
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
const int B=8;
namespace {
const int N=2e5+5;
vector <int> G[N];
int in[N];
queue <int> q;
stack <int> sta;
int col[N];
vector <int> ANS;
}
std::vector <int> Bob(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> X) {
return ANS;
for(int i=0;i<m;i++){
int u=U[i]+1,v=V[i]+1;
G[u].push_back(v),G[v].push_back(u);
in[u]++,in[v]++;
}
for(int i=1;i<=n;i++){
if(in[i]<B) q.push(i),sta.push(i);
}
while(q.size()){
int u=q.front(); q.pop();
for(int v: G[u]){
if(in[v]<B) continue;
in[v]--;
if(in[v]<B) q.push(v),sta.push(v);
}
}
int nw=0;
for(int i=1;i<=n;i++){
if(in[i]>=B){
for(int t=0;t<3;t++) col[i] |= X[nw]<<t,nw++;
}
else col[i]=-1;
}
while(sta.size()){
int u=sta.top(); sta.pop();
bool buc[B]={};
for(int v: G[u])
if(col[v]>=0) buc[col[v]]=1;
int nw=0;
while(buc[nw]) nw++;
col[u]=nw;
}
for(int i=1;i<=n;i++) ANS.push_back(col[i]);
// cout<<"Bob send: ";
// for(int x: ANS) cout<<x<<" ";
// cout<<'\n';
return ANS;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 29ms
memory: 22016kb
input:
10000 500000 5247 482 4774 3796 5245 9386 8794 2818 1911 3240 6925 6008 6313 1737 8668 4913 7892 5444 6740 2271 2100 53 8527 9605 4009 4765 5293 2683 6552 1326 8877 9929 402 9849 8664 6893 1998 7305 155 9477 9753 8036 448 5438 8535 3111 9493 406 7694 2030 5745 6890 5519 3106 8979 5098 9948 2453 5601...
output:
Success 1100000000110011101000011001000100101100001000100011001111000011000111110001011101000101001010101100000100101111001000010111111101111111100101110000101011010011011100001111010110000111001110010101101000010100011111101101101101100110101100001100010010111000111011111100110000010011001000101010...
input:
10000 500000 5247 482 4774 3796 5245 9386 8794 2818 1911 3240 6925 6008 6313 1737 8668 4913 7892 5444 6740 2271 2100 53 8527 9605 4009 4765 5293 2683 6552 1326 8877 9929 402 9849 8664 6893 1998 7305 155 9477 9753 8036 448 5438 8535 3111 9493 406 7694 2030 5745 6890 5519 3106 8979 5098 9948 2453 5601...
output:
Failed the length of C' should be exactly N!
result:
wrong answer invalid communication process!