QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101459 | #141. 8 染色 | lnyx | 0 | 36ms | 41492kb | C++14 | 2.9kb | 2023-04-29 21:02:12 | 2023-04-29 21:02:14 |
Judging History
Alice
#include "Alice.h"
#include<cstdio>
#include<iostream>
#include<vector>
namespace IO{
template<typename T> inline void rd(T &x){
x=0;bool f=0;char c=0;
while(c<'0'||c>'9') f|=c=='-',c=getchar();
while('0'<=c&&c<='9') x=x*10+(c^48),c=getchar();
x=f?-x:x;
}
template<typename T,typename ...Args> inline void rd(T &x,Args &...args){rd(x),rd(args...);}
template<typename T> inline void wt(char c,T x){
int stk[114],top=0;
if(x<0) x=-x,putchar('-');
do stk[++top]=x%10,x/=10; while(x);
while(top) putchar(stk[top--]+'0');
putchar(c);
}
template<typename T,typename ...Args> inline void wt(char c,T x,Args ...args){wt(c,x),wt(c,args...);}
};
using namespace IO;
using namespace std;
const int N=1e6+7;
int deg[N];
vector<int> Alice(int n,int m,vector<int>U,vector<int>V,vector<int>c){
vector<int> ans;
ans.resize(n<<1);
for(int i=0;i<m;i++){
int u=U[i]+1,v=V[i]+1;
deg[u]++,deg[v]++;
}
int cnt=-1;
for(int i=1;i<=n;i++){
// if(deg[i]<8) continue;
if(c[i]<=1) ans[++cnt]=0,ans[++cnt]=0;
else if(c[i]<=3) ans[++cnt]=0,ans[++cnt]=1;
else if(c[i]<=5) ans[++cnt]=1,ans[++cnt]=0;
else if(c[i]<=7) ans[++cnt]=1,ans[++cnt]=1;
}
return ans;
}
Bob
#include "Bob.h"
#include<cstdio>
#include<iostream>
#include<vector>
#define pb push_back
namespace IO{
template<typename T> inline void rd(T &x){
x=0;bool f=0;char c=0;
while(c<'0'||c>'9') f|=c=='-',c=getchar();
while('0'<=c&&c<='9') x=x*10+(c^48),c=getchar();
x=f?-x:x;
}
template<typename T,typename ...Args> inline void rd(T &x,Args &...args){rd(x),rd(args...);}
template<typename T> inline void wt(char c,T x){
int stk[114],top=0;
if(x<0) x=-x,putchar('-');
do stk[++top]=x%10,x/=10; while(x);
while(top) putchar(stk[top--]+'0');
putchar(c);
}
template<typename T,typename ...Args> inline void wt(char c,T x,Args ...args){wt(c,x),wt(c,args...);}
};
using namespace IO;
using namespace std;
const int N=1e6+7;
int id[N],c[N],deg[N]; bool st[N];
vector<int>g[N];
inline void dfs(int u,int color){
if(st[u]) return ;
st[u]=1,c[u]=color;
for(int v:g[u]) if(id[u]==id[v]) dfs(v,color^1);
}
vector<int> Bob(int n,int m,vector<int>U,vector<int>V,vector<int>x){
for(int i=0;i<m;i++){
int u=U[i]+1,v=V[i]+1;
deg[u]++,deg[v]++;
g[u].pb(v),g[v].pb(u);
}
int cnt=-1;
for(int i=1;i<=n;i++){
if(deg[i]<8) continue;
id[i]=(x[++cnt]<<1)+x[++cnt]+1;
}
for(int i=1;i<=n;i++){
if(!id[i]||st[i]) continue;
dfs(i,0);
}
vector<int>ans;
ans.resize(n);
for(int i=1;i<=n;i++){
/*if(id[i]) */ans[i-1]=(id[i]-1)*2+c[i];
// else{
// for(int j=0;j<8;j++) st[j]=0;
// for(int v:g[i]) if(id[v]) st[(id[v]-1)*2+c[v]]=1;
// for(int j=0;j<8;j++) if(!st[j]) ans[i-1]=j,c[i]=j,id[i]=1;
// }
}
return ans;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 36ms
memory: 41492kb
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 +000011100100100000010101000001100011001000111100100100010010010100010111000010111101111101011100011010101001001110110011001110010100100110110101010101110101000110101100111011011100101000000110000001011100110101011001001100101101111010101111000011100011100101011000001110111000100110001111110...
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 0 0 6 4 2 1 5 1 1 3 3 2 1 1 3 4 1 6 0 5 0 7 6 0 5 3 1 2 1 5 2 3 0 3 2 6 0 0 4 7 7 2 7 7 3 2 6 1 3 4 5 5 4 3 0 6 4 6 0 7 1 7 4 2 2 1 5 2 5 7 2 2 2 3 2 7 3 3 1 2 4 4 6 0 6 4 7 3 7 0 4 4 1 1 2 5 0 0 2 2 6 0 6 2 2 3 5 2 1 6 1 4 7 2 6 5 5 4 6 7 1 0 6 5 0 7 5 2 3 3 5 0 1 6 5 6 5 0 4 2 5 0 6 6 7 3 ...
result:
wrong answer the color of the vertex 3840 and 8477 is the same