MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Function main

codes/cpp/Code_4_05_1.cpp:8–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6vector<int> G[100009]; // G[i] �͒��_ i �ɗאڂ��钸�_�̃��X�g
7
8int main() {
9 // ����
10 cin >> N >> M;
11 for (int i = 1; i <= M; i++) {
12 cin >> A[i] >> B[i];
13 G[A[i]].push_back(B[i]); // ���_ A[i] �ɗאڂ��钸�_�Ƃ��� B[i] ��lj�
14 G[B[i]].push_back(A[i]); // ���_ B[i] �ɗאڂ��钸�_�Ƃ��� A[i] ��lj�
15 }
16
17 // �o�́iG[i].size() �͒��_ i �ɗאڂ��钸�_�̃��X�g�̑傫�� = �����j
18 for (int i = 1; i <= N; i++) {
19 cout << i << ": {";
20 for (int j = 0; j < G[i].size(); j++) {
21 if (j >= 1) cout << ","; // �R���}��؂�ŏo�͂���
22 cout << G[i][j]; // G[i][j] �͒��_ i �ɗאڂ��钸�_�̂��� j �Ԗڂ̂���
23 }
24 cout << "}" << endl;
25 }
26 return 0;
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected