QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665260#9246. Dominating PointmoosyWA 0ms3652kbC++201.4kb2024-10-22 10:30:552024-10-22 10:30:55

Judging History

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

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

answer

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

ll mp[5050][5050];
ll deg[5050];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n; cin >> n;
    string str;
    for(ll i = 1; i <= n; i ++ ) {
        cin >> str;
        str = "!" + str;
        for(ll j = 1; j < str.size(); j ++ ) {
            if(str[j] == '1') {
                mp[i][j] = 1;
                deg[i] ++ ;
            }
        }
    }
    set<ll> s;
    vector<ll> ans;
    for(ll i = 1; i <= n; i ++ ) {
        if(deg[i] > 0) {
            s.insert(i);
        }
    }
    ll ac = 1;
    for(ll i = 1; i <= 3; i ++ ) {
        if(s.size() == 0) {
            ac = 0; break;
        }
        ll maxx = 0, idx;
        for(auto j : s) {
            if(maxx < deg[j]) {
                maxx = deg[j]; idx = j;
            }
        }
        ans.push_back(idx);
        for(ll j = 1; j <= n; j ++ ) {
            bool ff = 0;
            for(ll k = 1; k <= n; k ++ ) {
                if(mp[j][k] && !mp[idx][k]) {
                    ff = 1; break;
                }
            }
            if(!ff && s.find(j) != s.end()) {
                s.erase(j);
            }
        }
    }
    if(!ac) {
        cout << "NOT FOUND\n";
    } else {
        for(auto i : ans) {
            cout << i << " ";
        }
    }
    cout << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3652kb

input:

3
011
001
000

output:

NOT FOUND


result:

wrong output format Expected EOF