QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#689516 | #9246. Dominating Point | YipChip# | WA | 231ms | 31256kb | C++14 | 1.1kb | 2024-10-30 17:32:50 | 2024-10-30 17:32:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PII;
void solve()
{
int n;
cin >> n;
vector<string> mp(n);
vector<bitset<3>> dp(n), f(n);
for (int i = 0; i < n; i ++ )
{
cin >> mp[i];
for (int j = 0; j < n; j ++ )
{
dp[i][j] = (mp[i][j] == '1');
f[i][j] = (mp[i][j] == '1');
}
dp[i][i] = f[i][i] = 1;
}
for (int k = 0; k < n; k ++ )
for (int i = 0; i < n; i ++ )
if (dp[i][k])
f[i] |= dp[k];
// puts("");
// for (int i = 0; i < n; i ++ ) cout << dp[i] << '\n';
// cout << "\n";
// for (int i = 0; i < n; i ++ ) cout << f[i] << '\n';
vector<int> ans;
for (int i = 0; i < n; i ++ )
if (f[i].count() == n)
ans.push_back(i + 1);
if (ans.size() < 3) cout << "NOT FOUND\n";
else cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T -- ) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3488kb
input:
6 011010 000101 010111 100001 010100 100010
output:
1 3 4
result:
ok OK, Answer correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
3 011 001 000
output:
NOT FOUND
result:
ok OK, Answer correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
3 010 001 100
output:
1 2 3
result:
ok OK, Answer correct.
Test #4:
score: -100
Wrong Answer
time: 231ms
memory: 31256kb
input:
4994 0100001010011001010101110010101000111101111100100001110010000111100000000100110100101000001010100000010010010110110110111010010010100110100000110110111001010111010111010111011001000101001000010001010111110000000100001100000111100011001010010111011100111010101110011000010111101011111110001111110...
output:
NOT FOUND
result:
wrong output format Expected integer, but "NOT" found