QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101458#141. 8 染色lnyx0 34ms41372kbC++142.9kb2023-04-29 21:01:462023-04-29 21:01:49

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-29 21:01:49]
  • 评测
  • 测评结果:0
  • 用时:34ms
  • 内存:41372kb
  • [2023-04-29 21:01:46]
  • 提交

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=2e5+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);
    int cnt=0;
    for(int i=0;i<U.size();i++){
        int u=U[i],v=V[i];
        deg[u]++,deg[v]++;
    }
    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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 34ms
memory: 41372kb

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
+000001110010010000001010100000110001100100011110010010001001001010001011100001011110111110101110001101010100100111011001100111001010010011011010101010111010100011010110011101101110010100000011000000101110011010101100100110010110111101010111100001110001110010101100000111011100010011000111111...

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 2 6 0 4 2 0 0 1 4 5 4 1 1 7 0 3 5 2 0 2 7 5 2 1 4 0 4 3 1 4 4 1 4 6 5 1 2 2 7 4 6 6 4 4 6 5 1 7 2 3 3 0 5 3 7 2 4 2 5 2 7 1 5 4 3 1 6 3 5 5 5 5 4 6 5 4 5 1 7 3 2 4 3 7 3 4 7 4 2 2 1 0 0 7 0 1 0 4 6 4 2 4 5 5 7 1 5 2 5 3 2 4 6 6 3 2 3 6 5 1 2 7 0 3 6 1 4 5 6 0 0 3 6 3 6 1 2 0 7 1 3 6 6 5 ...

result:

wrong answer the color of the vertex 5630 and 3196 is the same