QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#767351#9246. Dominating Point1903331632WA 0ms3592kbC++231.6kb2024-11-20 20:39:532024-11-20 20:39:54

Judging History

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

  • [2024-11-22 18:38:25]
  • hack成功,自动添加数据
  • (/hack/1238)
  • [2024-11-20 20:39:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-11-20 20:39:53]
  • 提交

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.