Submission #3005038
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int n,m; bitset<400> S[400];
int x[200005], y[200005];
bool no[200005];
int main() {
scanf("%d%d", &n, &m);
for (int i=0; i<n; i++) S[i][i] = 1;
for (int i=0; i<m; i++) scanf("%d%d", &x[i], &y[i]), --x[i], --y[i];
for (int i=m-1; i>=0; i--) {
for (int j=0; j<n; j++) {
if (S[j][x[i]] && S[j][y[i]]) no[j] = 1;
else if (S[j][x[i]]) S[j][y[i]] = 1;
else if (S[j][y[i]]) S[j][x[i]] = 1;
}
}
int ans = 0;
for (int i=0; i<n-1; i++)
for (int j=i+1; j<n; j++)
if (!no[i] && !no[j] && !(S[i] & S[j]).count()) {
++ans;
}
printf("%d\n", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
C - HSI |
User |
hanghang0702 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
655 Byte |
Status |
RE |
Exec Time |
100 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n, &m);
^
./Main.cpp:11:69: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i=0; i<m; i++) scanf("%d%d", &x[i], &y[i]), --x[i], --y[i];
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example_0, example_1, example_2 |
All |
example_0, example_1, example_2, handmade_0, rand_0, rand_1, rand_2, rand_3, rand_4, rand_5, rand_6, rand_7, rand_8, rand_9 |
Case Name |
Status |
Exec Time |
Memory |
example_0 |
RE |
98 ms |
256 KB |
example_1 |
RE |
98 ms |
256 KB |
example_2 |
RE |
97 ms |
256 KB |
handmade_0 |
RE |
97 ms |
256 KB |
rand_0 |
RE |
97 ms |
256 KB |
rand_1 |
RE |
97 ms |
256 KB |
rand_2 |
RE |
97 ms |
256 KB |
rand_3 |
RE |
97 ms |
256 KB |
rand_4 |
RE |
97 ms |
256 KB |
rand_5 |
RE |
98 ms |
256 KB |
rand_6 |
RE |
97 ms |
256 KB |
rand_7 |
RE |
100 ms |
256 KB |
rand_8 |
RE |
97 ms |
256 KB |
rand_9 |
RE |
97 ms |
256 KB |