mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 13:58:48 +00:00
E - Strictly Positive Matrix
https://codeforces.com/contest/402/submission/175552659
This commit is contained in:
parent
07d3deb8e2
commit
f2694dcba3
44
Codeforces/402/E/E.cpp
Normal file
44
Codeforces/402/E/E.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2005;
|
||||
|
||||
int n;
|
||||
std::bitset<N> g[N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1, x; j <= n; j++) {
|
||||
cin >> x;
|
||||
|
||||
g[i][j] = x;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
if (g[j][i]) g[j] |= g[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (g[i].count() != n) {
|
||||
cout << "NO" << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
cout << "YES" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user