We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d79be93 commit 29bbe1eCopy full SHA for 29bbe1e
21000/21316/21316.cpp
@@ -0,0 +1,32 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+
4
+#define FOR(i, a, b) for (int i = a; i < b; i++)
5
6
+int main() {
7
+ ios::sync_with_stdio(false); cin.tie(NULL);
8
+ vector<int> nbd[13];
9
10
+ FOR(i, 0, 12){
11
+ int x, y;
12
+ cin>>x>>y;
13
14
+ nbd[x].push_back(y);
15
+ nbd[y].push_back(x);
16
+ }
17
18
+ FOR(i, 1, 13){
19
+ if(nbd[i].size() == 3){
20
+ // the sum degrees of neighborhood is 6
21
+ int sum = 0;
22
+ FOR(j, 0, 3) sum += nbd[nbd[i][j]].size();
23
24
+ if(sum == 6){
25
+ cout<<i<<"\n";
26
+ break;
27
28
29
30
31
+ return 0;
32
+}
0 commit comments