-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10159.cpp
More file actions
56 lines (45 loc) · 935 Bytes
/
10159.cpp
File metadata and controls
56 lines (45 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// 10159.cpp
// algo
//
// Created by 박효정 on 2021/06/23.
//
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int n, m;
bool arr[101][101];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
cin >> m;
for (int i = 1; i <= m; i++)
{
int a,b;
cin >> a >> b;
arr[a][b] = true;
}
for (int k = 1; k <= n; k++)
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (arr[i][k] && arr[k][j])
{
arr[i][j] = true;
}
for (int i = 1; i <= n; i++)
{
int cnt = 0;
for (int j = 1; j <= n; j++){
if(i==j)
{
continue;
}
if (arr[i][j] == 0 && arr[j][i] == 0) cnt++;
}
cout << cnt << '\n';
}
}