QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#681692 | #9246. Dominating Point | Gordensoul | WA | 1ms | 3784kb | C++14 | 1.4kb | 2024-10-27 11:03:39 | 2024-10-27 11:03:40 |
Judging History
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)
{
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
Wrong Answer
time: 1ms
memory: 3784kb
input:
6 011010 000101 010111 100001 010100 100010
output:
3 1 0
result:
wrong answer Integer parameter [name=c] equals to 0, violates the range [1, 6]