QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#681740#9246. Dominating PointGordensoulRE 0ms0kbC++141.3kb2024-10-27 11:26:412024-10-27 11:26:42

Judging History

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

  • [2024-11-22 18:38:25]
  • hack成功,自动添加数据
  • (/hack/1238)
  • [2024-10-27 11:26:42]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-10-27 11:26:41]
  • 提交

answer

#include<bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3fll
#define debug(x) cerr<<#x<<"="<<x<<endl
using namespace std;
using ll=long long;
using ld=long double;
using pli=pair<ll,int>;
using pi=pair<int,int>;
template<typename A>
using vc=vector<A>;
inline int read()
{
    int s=0,w=1;char ch;
    while((ch=getchar())>'9'||ch<'0') if(ch=='-') w=-1;
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}
char s[5001][5002];
int S[5001];
int T[5001];
int d[5001];
int a,b,c;
int n;
inline int get(int *S)
{
    assert(S[0]);
    memset(d,0,sizeof(d));
    for(int i=1;i<=S[0];i++) for(int j=i+1;j<=S[0];j++)
    {
        if(s[S[i]][S[j]]=='1') d[S[i]]++;
        else d[S[j]]++;
    }
    int v=S[1];bool f=0;
    for(int i=2;i<=S[0];i++) if(d[S[i]]>d[v]) v=S[i];
    for(int i=1;i<=S[0];i++) if(s[S[i]][v]) f=1;
    return v;
}
int main()
{
    n=read();
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1),S[++S[0]]=i;
    a=get(S),S[0]=0;
    if(d[a]==n-1)
    {
        printf("NOT FOUND\n");
        return 0;
    }
    for(int i=1;i<=n;i++) if(a!=i)
    {
        if(s[a][i]=='1') S[++S[0]]=i;
        else T[++T[0]]=i;
    }
    b=get(T);

        S[0]=0;
        for(int i=1;i<=T[0];i++) if(T[i]!=b&&s[b][T[i]]=='0') S[++S[0]]=T[i];
        c=get(S);
 
    printf("%d %d %d\n",a,b,c);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

6
011010
000101
010111
100001
010100
100010

output:


result: