QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#667211 | #9246. Dominating Point | wysun | WA | 0ms | 3500kb | C++14 | 1.4kb | 2024-10-22 21:38:10 | 2024-10-22 21:38:38 |
Judging History
answer
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
const int N=5e3+10;
bool m[N][N];
int a,b,c;
int s[N];
int main()
{
int n;
cin>>n;
int a,maxa=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
char ch;
cin>>ch;
m[i][j] = (ch == '1');
s[i] += (ch == '1');
}
if(maxa<s[i])
{
maxa = s[i];
a = i;
}
}
if(maxa == n - 1)
{
cout<<"NOT FOUND"<<endl;
return 0;
}
vector<int> v;
for(int i=1;i<=n;i++)
if(m[i][a])
v.push_back(i);
int maxb=0,b;
memset(s,0,sizeof s);
for(auto x : v)
{
for(auto y : v)
{
if(m[x][y])
s[x] ++;
}
if(s[x]>maxb)
{
maxb = s[x];
b=x;
}
}
if(v.size() == 1) b = v[0];
int c;
if(maxb != v.size() - 1)
{
vector<int> w;
for(auto x : v)
if(m[x][b])
w.push_back(x);
int maxc=0;
memset(s,0,sizeof s);
for(auto x : w)
{
for(auto y : w)
if(m[x][y])
s[x]++;
if(maxc < s[x])
{
c = x;
maxc = s[x];
}
}
}
else
{
vector<int> w;
for(int j=1;j<=n;j++)
if(m[a][j])
w.push_back(j);
int maxc=0;
memset(s,0,sizeof s);
for(auto x : w)
{
for(auto y : w)
if(m[x][y])
s[x]++;
if(maxc < s[x])
{
c = x;
maxc = s[x];
}
}
}
cout<<a<<' '<<b<<' '<<c<<endl;
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3500kb
input:
6 011010 000101 010111 100001 010100 100010
output:
3 1 2
result:
wrong answer Wrong Answer, Point not dominating.