-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBali_pairs.cpp
More file actions
76 lines (71 loc) · 1.36 KB
/
Copy pathBali_pairs.cpp
File metadata and controls
76 lines (71 loc) · 1.36 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* @Date : 2020-11-11 18:29:35
* @Author : aerma7309
*/
#include <bits/stdc++.h>
using namespace std;
int FastIO = []() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
const int mod = 1e9 + 7;
#define int long long
int pow2mod(int p)
{
int n = 1;
for (int i = 0; i < p; i++)
{
n <<= 1;
n %= mod;
}
return n;
}
signed main()
{
int n;
cin >> n;
// int oo = 0, oe = 0, ee = 0;
// for (int i = 0, a, b; i < n; i++)
// {
// cin >> a >> b;
// if (a & 1 and b & 1)
// oo++;
// else if (not(a & 1) and not(b & 1))
// ee++;
// else
// oe++;
// }
int dp[n][2], v[n][2];
memset(dp, 0, sizeof dp);
for (int i = 0; i < n; i++)
{
cin >> v[i][0] >> v[i][1];
}
if (v[0][0] & 1)
dp[0][1]++;
else
dp[0][0]++;
if (v[0][1] & 1)
dp[0][1]++;
else
dp[0][0]++;
for (int i = 1; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
dp[i][v[i][j] & 1] += dp[i - 1][(v[i][j] + j)%2];
dp[i][v[i][j] & 1] %= mod;
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cout << dp[i][j] << " ";
}
cout << "\n";
}
return 0;
}