QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671227#9246. Dominating Pointsnow_miku#WA 0ms3820kbC++201.3kb2024-10-24 11:48:202024-10-24 11:48:20

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 5e3 + 5;

bitset<N> G[N];

int main() {
    int n; cin >> n;
    for (int i = 0;i < n;i++) {
        string s; cin >> s;
        for (int j = 0;j < s.size();j++) {
            G[i][j] = s[j] - '0';
        }
    }
    vector<pair<int, int>> a(n);
    for (int i = 0;i < n;i++) {
        a[i].first = G[i].count(), a[i].second = i;
    }
    // auto cmp = [&](int i, int j) -> bool {
    //     return G[i].count() > G[j].count();
    // };
    sort(a.rbegin(), a.rend());
    // reverse(a.begin(), a.end());
    // for (int i = 0;i < n;i++) {
    //     cout << a[i].second << " " << a[i].first << '\n';
    // }
    vector<int> ans;
    ans.push_back(a[0].second);
    for (int i = 1;i < n;i++) {
        int tt = a[i].second;
        bitset<N> tmp = G[tt];
        tmp[tt] = 1;
        // cout << tt << ": " << tmp << '\n';
        int ok = 1;
        for (int x : ans) {
            if ((G[x] & tmp) == tmp) {
                ok = 0;
                break;
            }
        }
        if (ok) ans.push_back(tt);
        if (ans.size() >= 3) {
            for (int x : ans) {
                cout << x + 1 << " ";
            }
            cout << '\n';
            return 0;
        }
    }
    cout << "NOT FONUD" << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

6
011010
000101
010111
100001
010100
100010

output:

3 1 6 

result:

ok OK, Answer correct.

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3816kb

input:

3
011
001
000

output:

NOT FONUD

result:

wrong answer Wrong Answer, Answer incorrect.