QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671047 | #9246. Dominating Point | Evan | TL | 0ms | 3872kb | C++17 | 794b | 2024-10-24 10:27:08 | 2024-10-24 10:27:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 5010
bitset<N> s[N],tmp;
int n,cnt[N];
void solve()
{
scanf("%d",&n);
int i,j,k;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf("%1d",&k);
s[i][j]=k;
if(i==j){s[i][j]=1;}
}
cnt[i]=s[i].count();
}
vector<int> ans;
for(i=1;i<=n&&ans.size()<3;i++)
{
if(cnt[i]==n){ans.push_back(i);continue;}
tmp=s[i];
for(j=1;j<=n;j++)
{
if(s[i][j]){tmp|=s[j];}
}
if(tmp.count()==n){ans.push_back(i);}
}
if(ans.size()==3){printf("%d %d %d\n",ans[0],ans[1],ans[2]);}
else{printf(" NOT FOUND\n");}
}
int main()
{
int t=1;
while(t--){solve();}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
input:
6 011010 000101 010111 100001 010100 100010
output:
1 3 4
result:
ok OK, Answer correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
3 011 001 000
output:
NOT FOUND
result:
ok OK, Answer correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
3 010 001 100
output:
1 2 3
result:
ok OK, Answer correct.
Test #4:
score: -100
Time Limit Exceeded
input:
4994 0100001010011001010101110010101000111101111100100001110010000111100000000100110100101000001010100000010010010110110110111010010010100110100000110110111001010111010111010111011001000101001000010001010111110000000100001100000111100011001010010111011100111010101110011000010111101011111110001111110...
output:
1 2 3