#include<bits/stdc++.h>
#define MAXN 100007
using namespace std;
int n,m,a[MAXN],b[MAXN],ans;
bool between[5007][5007];
vector<int> lines[MAXN];
bitset<5007> bits[5007],curr;
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>a[i]>>b[i];
bits[b[i]][a[i]]=1;
}
for(int i=1;i<=n;i++){
for(int f=1;f<=i-1;f++){
curr=bits[i]&bits[f];
if(curr.count()!=0 and bits[i][f]==0){
bits[i][f]=1; ans++;
}
}
}
cout<<ans+m<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2756 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
5 ms |
2644 KB |
Output is correct |
7 |
Correct |
3 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
3 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
11 |
Correct |
3 ms |
2644 KB |
Output is correct |
12 |
Correct |
3 ms |
2644 KB |
Output is correct |
13 |
Correct |
3 ms |
2644 KB |
Output is correct |
14 |
Correct |
3 ms |
2644 KB |
Output is correct |
15 |
Correct |
3 ms |
2728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2756 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
5 ms |
2644 KB |
Output is correct |
7 |
Correct |
3 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
3 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
11 |
Correct |
3 ms |
2644 KB |
Output is correct |
12 |
Correct |
3 ms |
2644 KB |
Output is correct |
13 |
Correct |
3 ms |
2644 KB |
Output is correct |
14 |
Correct |
3 ms |
2644 KB |
Output is correct |
15 |
Correct |
3 ms |
2728 KB |
Output is correct |
16 |
Correct |
3490 ms |
6468 KB |
Output is correct |
17 |
Correct |
3680 ms |
6512 KB |
Output is correct |
18 |
Correct |
3486 ms |
6512 KB |
Output is correct |
19 |
Correct |
3499 ms |
6516 KB |
Output is correct |
20 |
Correct |
3417 ms |
6516 KB |
Output is correct |
21 |
Correct |
3402 ms |
5780 KB |
Output is correct |
22 |
Correct |
3518 ms |
6504 KB |
Output is correct |
23 |
Correct |
3415 ms |
6512 KB |
Output is correct |
24 |
Correct |
3511 ms |
6516 KB |
Output is correct |
25 |
Correct |
3631 ms |
6516 KB |
Output is correct |
26 |
Correct |
3728 ms |
6524 KB |
Output is correct |
27 |
Correct |
3920 ms |
5784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
5184 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2756 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
5 ms |
2644 KB |
Output is correct |
7 |
Correct |
3 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
3 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
11 |
Correct |
3 ms |
2644 KB |
Output is correct |
12 |
Correct |
3 ms |
2644 KB |
Output is correct |
13 |
Correct |
3 ms |
2644 KB |
Output is correct |
14 |
Correct |
3 ms |
2644 KB |
Output is correct |
15 |
Correct |
3 ms |
2728 KB |
Output is correct |
16 |
Correct |
3490 ms |
6468 KB |
Output is correct |
17 |
Correct |
3680 ms |
6512 KB |
Output is correct |
18 |
Correct |
3486 ms |
6512 KB |
Output is correct |
19 |
Correct |
3499 ms |
6516 KB |
Output is correct |
20 |
Correct |
3417 ms |
6516 KB |
Output is correct |
21 |
Correct |
3402 ms |
5780 KB |
Output is correct |
22 |
Correct |
3518 ms |
6504 KB |
Output is correct |
23 |
Correct |
3415 ms |
6512 KB |
Output is correct |
24 |
Correct |
3511 ms |
6516 KB |
Output is correct |
25 |
Correct |
3631 ms |
6516 KB |
Output is correct |
26 |
Correct |
3728 ms |
6524 KB |
Output is correct |
27 |
Correct |
3920 ms |
5784 KB |
Output is correct |
28 |
Runtime error |
4 ms |
5184 KB |
Execution killed with signal 11 |
29 |
Halted |
0 ms |
0 KB |
- |