QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#681737#9246. Dominating PointGordensoulWA 129ms28188kbC++141.4kb2024-10-27 11:25:392024-10-27 11:25:40

Judging History

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

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

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<<9;
    }
    else
    {
        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;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3992kb

input:

6
011010
000101
010111
100001
010100
100010

output:

3 1 4

result:

ok OK, Answer correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

3
011
001
000

output:

NOT FOUND

result:

ok OK, Answer correct.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

3
010
001
100

output:

1 3 2

result:

ok OK, Answer correct.

Test #4:

score: -100
Wrong Answer
time: 129ms
memory: 28188kb

input:

4994
0100001010011001010101110010101000111101111100100001110010000111100000000100110100101000001010100000010010010110110110111010010010100110100000110110111001010111010111010111011001000101001000010001010111110000000100001100000111100011001010010111011100111010101110011000010111101011111110001111110...

output:

91505 3625 0

result:

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