-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path353A
More file actions
40 lines (37 loc) · 775 Bytes
/
353A
File metadata and controls
40 lines (37 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define pii pair<int,int>
#define vpi vector<pii>
#define mp unordered_map<char,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define nline "\n"
#define MOD1 1000000007
#define MOD2 1000000009
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;cin>>n;
int l=0,r=0;
bool flag=false;
//int x,y;
for(int x,y; cin>>x>>y;){
if(n==1 && x%2+y%2==1){
cout<<-1<<nline;
return 0;
}
if(x%2+y%2==1){
flag=true;
}
l+=x;r+=y;
}
if (l%2==0 && r%2==0) cout<<0<<nline;
else if (l%2==1 && r%2==1 && flag) cout<<1<<nline;
else cout<<-1<<nline;
return 0;
}