QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#681726#9246. Dominating PointGordensoulWA 1ms5896kbC++141.4kb2024-10-27 11:20:372024-10-27 11:20:37

Judging History

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

  • [2024-11-22 18:38:25]
  • hack成功,自动添加数据
  • (/hack/1238)
  • [2024-10-27 11:20:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5896kb
  • [2024-10-27 11:20:37]
  • 提交

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);
 if(d[b]==T[0]-1)cout<<6;
        T[0]=0;
        for(int i=1;i<=S[0];i++) if(s[S[i]][b]=='1') T[++T[0]]=S[i];
        c=get(T);
    
    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
Wrong Answer
time: 1ms
memory: 5896kb

input:

6
011010
000101
010111
100001
010100
100010

output:

63 1 4

result:

wrong answer Integer parameter [name=a] equals to 63, violates the range [1, 6]