QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#647097#141. 8 染色staring0 0ms0kbC++142.2kb2024-10-17 11:39:422024-10-17 11:39:45

Judging History

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

  • [2024-10-17 11:39:45]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-10-17 11:39:42]
  • 提交

Alice

#include "Alice.h"
#include<bits/stdc++.h>
using namespace std;
namespace staring
{
    typedef long long LL;
    typedef vector<int> VEC;
    typedef pair<int,int> PII;

    #define FOR(i,a,b) for(int i=(a),__i=(b);i<=__i;i++)
    #define ROF(i,a,b) for(int i=(a),__i=(b);i>=__i;i--)

    template<typename TYPE>
    TYPE gmax(TYPE &x,const TYPE y){return x<y&&(x=y),x;}
    template<typename TYPE>
    TYPE gmin(TYPE &x,const TYPE y){return x>y&&(x=y),x;}
}using namespace staring;

constexpr int N=2e5+5;

int dega[N];

VEC Alice(int n,int m,VEC u,VEC v,VEC c)
{
    FOR(i,0,m-1)++dega[u[i]],++dega[v[i]];

    VEC X;
    FOR(i,0,n-1)
        if(dega[i]>=8)X.push_back(c[i]>>2),X.push_back(c[i]>>1&1);
    return X;
}

Bob

#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;
namespace staring
{
    typedef long long LL;
    typedef vector<int> VEC;
    typedef pair<int,int> PII;

    #define FOR(i,a,b) for(int i=(a),__i=(b);i<=__i;i++)
    #define ROF(i,a,b) for(int i=(a),__i=(b);i>=__i;i--)

    template<typename TYPE>
    TYPE gmax(TYPE &x,const TYPE y){return x<y&&(x=y),x;}
    template<typename TYPE>
    TYPE gmin(TYPE &x,const TYPE y){return x>y&&(x=y),x;}
    
    int InDeX=2;
    #define FORG(i,v,u) for(int i=he[u],v=to[i];i;v=to[i=ne[i]])
    #define ADDE(a,b) (to[InDeX]=b,ne[InDeX]=he[a],he[a]=InDeX++)
    #define ADDE2(a,b,c) (to[InDeX]=b,co[InDeX]=c,ne[InDeX]=he[a],he[a]=InDeX++)

}using namespace staring;

constexpr int N=2e5+5,M=N<<1;

int he[N],ne[M<<1],to[M<<1];
int degb[N];
int col[N],vis[N];
VEC c;

void dfs(int u)
{
	vis[u]=1;
    FORG(i,v,u)(!vis[v]&&c[u]==c[v])&&(col[v]=col[u]^1,dfs(v),0);
}

VEC Bob(int n,int m,VEC u,VEC v,VEC x)
{
    FOR(i,0,m-1)++degb[u[i]],++degb[v[i]],ADDE(u[i],v[i]),ADDE(v[i],u[i]);
    for(int i=0,j=0;i<n;i++)
        if(degb[i]>=8)c.push_back(x[j]<<1|x[j+1]),j+=2;
        else c.push_back(-1);
    
    memset(col,-1,sizeof(col));
    FOR(i,0,n-1)
        if(~c[i]&&!vis[i])col[i]=c[i]<<1,dfs(i);
    FOR(i,0,n-1)
	{
        if(~c[i])continue;
		FOR(j,0,7)
		{
			int flag=1;
			FORG(idx,k,i)flag&=col[k]!=j;
			if(flag){col[i]=j;break;}
		}
	}
    
    FOR(i,0,n-1)c[i]=col[i];
    return c;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Stage 2: Program Bob Time Limit Exceeded

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

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:

Unauthorized output

result: