#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Foxyy cin.tie(0); cout.sync_with_stdio(0); cout.tie(0);
struct Solver {
int& n;
vector<vector<int>>& adj;
void solve() {
if (n % 4 != 0) {
cout << "-1\n";
return;
}
cout << n/2 << '\n';
}
};
signed main() {
Foxyy
int T = 1;
// cin >> T;
while(T--) {
int n;
cin >> n;
vector<vector<int>> adj(n);
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
a--, b--;
adj[a].push_back(b);
adj[b].push_back(a);
}
Solver solver{n, adj};
solver.solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
37 ms |
6032 KB |
Output is correct |
6 |
Correct |
41 ms |
6036 KB |
Output is correct |
7 |
Correct |
37 ms |
5928 KB |
Output is correct |
8 |
Correct |
40 ms |
5928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
37 ms |
6032 KB |
Output is correct |
6 |
Correct |
41 ms |
6036 KB |
Output is correct |
7 |
Correct |
37 ms |
5928 KB |
Output is correct |
8 |
Correct |
40 ms |
5928 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |