#include <bits/stdc++.h>
using namespace std;
#define int long long // a.k.a. TLE creator
#define all(x) x.begin(), x.end()
template<class A, class B> istream& operator >>(istream &o, pair<A, B> &x){return o >> x.first >> x.second;}
template<class A, class B> ostream& operator <<(ostream &o, pair<A, B> &x){return o << x.first << ' ' << x.second << ' ';}
void setIO(){ios::sync_with_stdio(false); cin.tie(0);}
const int INF = INT_MAX, MOD = 998244353, N = 1e5 + 2, K = __lg(N) + 1;
signed main(){
setIO();
int n;
cin >> n;
vector<int> adj[N];
for(int i = 0; i < n; i++){
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
cout << (n % 4 == 0 ? n / 2 : -1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2636 KB |
Output is correct |
2 |
Correct |
2 ms |
2636 KB |
Output is correct |
3 |
Correct |
2 ms |
2656 KB |
Output is correct |
4 |
Correct |
1 ms |
2636 KB |
Output is correct |
5 |
Correct |
37 ms |
6720 KB |
Output is correct |
6 |
Correct |
38 ms |
6748 KB |
Output is correct |
7 |
Correct |
43 ms |
6724 KB |
Output is correct |
8 |
Correct |
41 ms |
6804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2636 KB |
Output is correct |
2 |
Correct |
2 ms |
2636 KB |
Output is correct |
3 |
Correct |
2 ms |
2656 KB |
Output is correct |
4 |
Correct |
1 ms |
2636 KB |
Output is correct |
5 |
Correct |
37 ms |
6720 KB |
Output is correct |
6 |
Correct |
38 ms |
6748 KB |
Output is correct |
7 |
Correct |
43 ms |
6724 KB |
Output is correct |
8 |
Correct |
41 ms |
6804 KB |
Output is correct |
9 |
Incorrect |
2 ms |
2764 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |