QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671180 | #9246. Dominating Point | snow_miku# | WA | 0ms | 3804kb | C++20 | 1.0kb | 2024-10-24 11:30:55 | 2024-10-24 11:30:55 |
Judging History
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.