QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671180#9246. Dominating Pointsnow_miku#WA 0ms3804kbC++201.0kb2024-10-24 11:30:552024-10-24 11:30:55

Judging History

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

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

answer

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

const int N = 5e3 + 5;

bitset<N> G[N];

bool cmp(int i, int j) {
    return G[i].count() > G[j].count();
}

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<int> a(n);
    for (int i = 0;i < n;i++) {
        a[i] = i;
    }
    sort(a.begin(), a.end(), cmp);
    vector<int> ans;
    ans.push_back(a[0]);
    for (int i = 1;i < n;i++) {
        bitset<N> tmp = G[a[i]];
        tmp[a[i]] = 1;
        int ok = 1;
        for (int x : ans) {
            if ((G[x] & tmp) == tmp) {
                ok = 0;
                break;
            }
        }
        if (ok) ans.push_back(a[i]);
        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: 3600kb

input:

6
011010
000101
010111
100001
010100
100010

output:

3 1 4 

result:

ok OK, Answer correct.

Test #2:

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

input:

3
011
001
000

output:

NOT FONUD

result:

wrong answer Wrong Answer, Answer incorrect.