QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#767351 | #9246. Dominating Point | 1903331632 | WA | 0ms | 3592kb | C++23 | 1.6kb | 2024-11-20 20:39:53 | 2024-11-20 20:39:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()
#define int long long
#define endl '\n'
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int n, k;
char mp[5005][5005];
vector<int> side[5005];
bool bfs(int x)
{
queue<int> q;
q.push(x);
map<int, int> st;
st[x] = 1;
while (!q.empty())
{
int u = q.front();
q.pop();
for (int v : side[u])
{
if (st[v])
continue;
q.push(v);
}
}
return true;
}
void solve()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
cin >> mp[i][j];
if (mp[i][j] == '1')
{
side[j].push_back(i);
}
}
}
vector<int> res;
for (int i = 1; i <= n; i++)
{
map<int, int> st;
st[i] = 1;
for (int u : side[i])
{
st[u] = 1;
for (int v : side[u])
{
st[v] = 1;
}
}
// for (auto t : st)
// {
// cout << t.first << " " << t.second << endl;
// }
// cout << endl;
if (st.size() == n)
{
res.push_back(i);
}
}
if (res.size() >= 3)
{
cout << res[0] << ' ' << res[1] << ' ' << res[2] << endl;
}
else
cout << "NOT FOUND" << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
input:
6 011010 000101 010111 100001 010100 100010
output:
1 2 4
result:
wrong answer Wrong Answer, Point not dominating.