QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#665260 | #9246. Dominating Point | moosy | WA | 0ms | 3652kb | C++20 | 1.4kb | 2024-10-22 10:30:55 | 2024-10-22 10:30:55 |
Judging History
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