Skip to content

Commit 29bbe1e

Browse files
committed
solved 21316
1 parent d79be93 commit 29bbe1e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

21000/21316/21316.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)