-
Notifications
You must be signed in to change notification settings - Fork 0
/
_a_color_box.cpp
92 lines (83 loc) · 2.39 KB
/
_a_color_box.cpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <iostream>
#include <string>
using namespace std;
template <typename T> inline void inp (T &n) {
n = 0;
int ch = getchar_unlocked (), sign = 1;
while (ch < '0' || ch > '9') {
if (ch == '-') sign = -1; // only if also negative integer
ch = getchar_unlocked ();
}
while (ch >= '0' && ch <= '9')
n = (n << 3) + (n << 1) + ch - '0', ch = getchar_unlocked ();
n *= sign; // only if also negative integer
}
inline int inp () {
int n = 0;
int ch = getchar_unlocked (), sign = 1;
while (ch < '0' || ch > '9') {
if (ch == '-') sign = -1; // only if also negative integer
ch = getchar_unlocked ();
}
while (ch >= '0' && ch <= '9')
n = (n << 3) + (n << 1) + ch - '0', ch = getchar_unlocked ();
n *= sign; // only if also negative integer
return n;
}
template <typename T> inline void puti (T n, char lc) {
if (0 == n) {
putchar_unlocked ('0');
if (lc) putchar_unlocked (lc);
return;
}
bool sign = false;
if (n < 0) sign = true, n = -n;
char s[20]; int rdi =-1;
while (n) {
s [++rdi] = '0' + n % 10;
n /= 10;
}
if (sign) putchar_unlocked ('-');
while (rdi >= 0) putchar_unlocked (s [rdi--]);
if (lc) putchar_unlocked (lc);
}
inline void puts (string s) {
for (char c : s) putchar_unlocked (c);
}
inline void inps (string &i) {
i = "";
char temp = getchar_unlocked ();
while (temp == '\n' or temp == ' ') temp = getchar_unlocked ();
while (temp != '\n' and temp != ' ' and temp != EOF) i += temp, temp = getchar_unlocked ();
}
inline void inpc (char &i) {
char temp = getchar_unlocked ();
while (temp == '\n' or temp == ' ') temp = getchar_unlocked ();
if (temp != EOF) i = temp;
}
inline char inpc () {
char temp = getchar_unlocked ();
while (temp == '\n' or temp == ' ') temp = getchar_unlocked ();
if (temp != EOF) return temp;
else return '\n';
}
int main () {
int i, t, n, df;
long long hi;
inp (t);
while (t--) {
inp (n);
int a [n], b [n];
for (i = 0; i < n; i++) inp (a [i]);
for (i = 0; i < n; i++) inp (b [i]);
hi = 0;
for (i = 0; i < n; i++) {
df = a [i] - b [i];
if (df > 0) hi += df / 2;
else hi += df;
}
if (hi < 0) puts ("No");
else puts ("Yes");
}
return 0;
}