-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathABC_160_D.cpp
47 lines (45 loc) · 991 Bytes
/
ABC_160_D.cpp
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
#include <bits/stdc++.h>
using namespace std;
const int NN = 2001;
int res[NN] = { 0 };
void bfs(vector<int> g[],int start) {
queue<pair<int,int>> q;
q.push(make_pair(start, 0));
bool visited[NN] = {false};
visited[start] = true;
//cout << "½ÃÀÛ³ëµå" << start << "\n";
while (!q.empty()) {
auto item = q.front();
int cur = item.first;
int d = item.second;
q.pop();
if (d != 0) {
res[d] += 1;
//cout << "ÇöÀç³ëµå" << cur << " °Å¸® " << d << "\n";
}
for (int i = 0; i<g[cur].size(); i++) {
int node = g[cur][i];
if (!visited[node]) {
q.push(make_pair(node, d + 1));
visited[node] = true;
}
}
}
}
int main() {
int N, X, Y;
cin >> N >> X >> Y;
vector<int> g[NN];
for (int i = 1; i < N; i++) {
g[i].push_back(i + 1);
g[i + 1].push_back(i);
}
g[X].push_back(Y);
g[Y].push_back(X);
for (int i = 1; i < N+1; i++) {
bfs(g, i);
}
for (int i = 1; i <N; i++) {
cout << res[i]/2 << "\n";
}
}