solution
stringlengths 10
983k
| difficulty
int64 0
25
| language
stringclasses 2
values |
---|---|---|
#!/usr/bin/env python3
import itertools, functools, math
def solve():
v1, v2 = map(int, input().split())
t, d = map(int, input().split())
s = [0]*(t-1)
for i in range(t-1):
s[i] = min(v1 + d*i, v2 + d*(t-i-1))
s += [v2]
return sum(s)
if __name__ == '__main__':
print(solve())
| 8 | PYTHON3 |
n = int(input())
a = list(map(int, input().split()))
odd = 0
even = 0
for i in range(0,len(a)):
if a[i] % 2 == 0:
even+=1
c = i
else:
odd+=1
d = i
print(d+1 if odd<even else c+1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int i, j, m, n, p, k, pr[300005], a[300005], ans;
int mp[1200005], vis[1200005];
void Prime(int x) {
int i;
for (i = 2; i * i <= x; ++i)
while (x % i == 0) pr[++pr[0]] = i, x /= i;
if (x > 1) pr[++pr[0]] = x;
}
int dfs(int x) {
if (!x) return 0;
if (vis[x]) return mp[x];
vis[x] = 1;
int ans = 0, i, mex[45];
for (i = 0; i < 45; ++i) mex[i] = 0;
for (i = 1; x >= (1 << i); ++i) {
int p = (x & ((1 << i) - 1)) | (x >> i);
if (p & 1) --p;
mex[dfs(p)] = 1;
}
for (i = 0; mex[i]; ++i)
;
return mp[x] = i;
}
int Dfs(int x) {
if (x < 1048576) return mp[x];
int i, mex[45];
for (i = 0; i < 45; ++i) mex[i] = 0;
for (i = 1; x >= (1 << i); ++i) {
int p = (x & ((1 << i) - 1)) | (x >> i);
if (p & 1) --p;
mex[Dfs(p)] = 1;
}
for (i = 0; mex[i]; ++i)
;
return i;
}
int mex[105];
int main() {
scanf("%d", &n);
for (i = 1; i <= n; ++i) scanf("%d", &a[i]), Prime(a[i]);
sort(pr + 1, pr + pr[0] + 1);
pr[0] = unique(pr + 1, pr + pr[0] + 1) - (pr + 1);
for (i = 0; i < (1 << 20); ++i) dfs(i);
for (i = 1; i <= pr[0]; ++i) {
int now = 0;
for (j = 1; j <= n; ++j) {
int s = 0;
while (a[j] % pr[i] == 0) a[j] /= pr[i], ++s;
now |= (1 << s);
}
if (now & 1) --now;
ans ^= Dfs(now);
}
if (!ans)
printf("Arpa");
else
printf("Mojtaba");
}
| 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
vector<int> v[N];
bool viz[N];
int cnt;
pair<long long, long long> a[N];
void dfs(int x) {
viz[x] = 1;
cnt++;
for (auto it : v[x])
if (!viz[it]) dfs(it);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
vector<pair<long long, long long> > ev;
int n, nredge = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].first >> a[i].second;
ev.push_back({a[i].first, i});
ev.push_back({a[i].second, i});
}
sort(ev.begin(), ev.end());
set<pair<long long, long long> > s;
for (auto it : ev) {
if (nredge >= n) break;
if (s.count(it))
s.erase(it);
else {
int i = it.second;
long long r = a[i].second;
for (auto it : s) {
if (it.first > r) break;
int j = it.second;
v[i].push_back(j);
v[j].push_back(i);
nredge++;
if (nredge >= n) break;
}
s.insert({r, i});
}
}
dfs(1);
if (cnt == n && nredge == n - 1)
cout << "YES\n";
else
cout << "NO\n";
}
| 10 | CPP |
k = int(input())
l = int(input())
m = int(input())
n = int(input())
d = int(input())
hurt = []
for i in range(1, d+1):
if i%k == 0 or i%l == 0 or i%m == 0 or i%n == 0:
hurt.append(i)
print(len(hurt)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
const int MN = 2.5e2 + 10;
int N, M, a[MN][MN], b[MN][MN], x = -1, y = -1, wh[MN * MN];
bool vr[MN], vc[MN], ur, uc;
std::queue<int> q;
int main() {
scanf("%d%d", &N, &M);
for (int i = 0; i < N; ++i)
for (int j = 0; j < M; ++j) {
scanf("%d", a[i] + j);
wh[a[i][j]] = i * M + j;
}
for (int i = N * M; i; --i) {
int r = wh[i] / M, c = wh[i] - r * M;
if (!vr[r])
++x, ur = 1, vr[r] = 1;
else
ur = 0;
if (!vc[c])
++y, uc = 1, vc[c] = 1;
else
uc = 0;
if (ur || uc) {
b[x][y] = i;
if (ur)
for (int j = y - 1; j >= 0; --j) q.push(x * M + j);
if (uc)
for (int j = x - 1; j >= 0; --j) q.push(j * M + y);
} else {
assert(!q.empty());
int t = q.front();
q.pop();
b[t / M][t % M] = i;
}
}
assert(q.empty());
for (int i = 0; i < N; ++i)
for (int j = 0; j < M; ++j) printf("%d%c", b[i][j], " \n"[j + 1 == M]);
return 0;
}
| 10 | CPP |
#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> q;
int main() {
long long n, k, s, m;
cin >> n >> k;
for (int i = 0; i < k; i++) {
scanf("%I64d%I64d", &s, &m);
long long hamada = s + m;
printf("%I64d\n", hamada);
q.push(-hamada);
}
for (int i = 0; i < n - k; i++) {
scanf("%I64d%I64d", &s, &m);
s = max(s, -q.top()) + m;
q.push(-s);
q.pop();
printf("%I64d\n", s);
}
return 0;
}
| 10 | CPP |
I=lambda:list(map(int,input().split()))
n,=I()
l=[0]+I()
for i in range(1,n+1):
l[i]+=l[i-1]
f={}
m=0
ans=0
for i in range(n+1):
if l[i] in f:
m=max(m,f[l[i]]+1)
ans+=i-m
f[l[i]]=i
print(ans)
| 9 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long f[100001], inv[100001];
long long nCk(long long a, long long b) {
return ((f[a] * inv[b]) % mod * inv[a - b]) % mod;
}
long long fastPower(long long a, long long b) {
if (b == 0) return 1;
long long res = fastPower(a, b / 2);
if (b % 2) {
return ((res * res) % mod * a) % mod;
}
return (res * res) % mod;
}
int main() {
long long n;
cin >> n;
f[0] = fastPower(1, mod - 2);
inv[0] = fastPower(1, mod - 2);
for (int i = 1; i <= 100000; ++i) {
f[i] = (i * f[i - 1]) % mod;
inv[i] = fastPower(f[i], mod - 2);
}
long long ans = 0;
for (int k = 1; k <= n; ++k) {
ans = (ans + nCk(n, k) * nCk(n - 1, k - 1)) % mod;
}
ans = ((2 * ans) % mod - n + mod) % mod;
cout << ans << endl;
return 0;
}
| 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
int f[200010];
int g[200010];
vector<int> v[200010];
int n, m;
vector<int> l;
int dfs(int x, int fa) {
int ma = 0;
g[x] = fa;
for (int i = 0; i < v[x].size(); i++) {
if (v[x][i] != fa) {
int y = dfs(v[x][i], x);
ma = max(ma, y);
}
}
return f[x] = ma + 1;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i < n; i++) {
int x, y;
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
dfs(1, 0);
int t = 0;
for (int i = m; i != 1; i = g[i]) t++;
int t2 = (t - 1) / 2;
int ma = -1;
for (int i = 1, j = m; i <= t2 + 1; i++, j = g[j]) {
ma = max(ma, t - i + f[j] - 1);
}
cout << (ma + 1) * 2 << endl;
return 0;
}
| 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long inff = 0x3f3f3f3f3f3f3f3f;
pair<int, int> a[18], c[18];
int main() {
cin.tie(0);
int r, b;
scanf("%d", &r), scanf("%d", &b);
for (int i(1); i <= (r); ++i)
scanf("%d", &a[i].first), scanf("%d", &a[i].second);
for (int i(1); i <= (b); ++i)
scanf("%d", &c[i].first), scanf("%d", &c[i].second);
if (r != b)
puts("NO");
else {
puts("YES");
}
return 0;
}
| 11 | CPP |
n, k = map(int, input().strip().split())
M = []
for _ in range(n):
L = list(input())
M.append(L)
count = 0
for i in range(n):
for j in range(k):
if M[i][j] == 'W':
if i + 1 < n and M[i + 1][j] == 'P':
count = count + 1
elif j + 1 < k and M[i][j + 1] == 'P':
count = count + 1
elif i - 1 >= 0 and M[i - 1][j] == 'P':
count = count + 1
elif j - 1 >= 0 and M[i][j - 1] == 'P':
count = count + 1
print(count) | 8 | PYTHON3 |
t = int(input())
for _ in range(t):
s = input()
if( all(s[0]==s[i] for i in range(len(s)))):
print(s)
elif(s[0]=='0'):
print('01'*len(s))
else:
print('10'*len(s))
| 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, a[N], s[N], js;
int p, q;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
int m;
scanf("%d", &m);
int t = m >> 1;
for (int j = 0; j <= m - 1; ++j) {
scanf("%d", &a[j]);
if (j < t)
p += a[j];
else
q += a[j];
}
if (m & 1) q -= a[t], s[++js] = a[t];
}
sort(s + 1, s + js + 1, greater<int>());
for (int i = 1; i <= js; ++i)
if (i & 1)
p += s[i];
else
q += s[i];
printf("%d %d\n", p, q);
return 0;
}
| 11 | CPP |
#include <bits/stdc++.h>
using namespace std;
template <typename _Tp>
inline void IN(_Tp& dig) {
char c;
bool flag = 0;
dig = 0;
while (c = getchar(), !isdigit(c))
if (c == '-') flag = 1;
while (isdigit(c)) dig = dig * 10 + c - '0', c = getchar();
if (flag) dig = -dig;
}
int n, m;
struct Graph {
int head[(1000005)], nxt[(2000005)], to[(2000005)], c1[(2000005)],
c2[(2000005)], sz;
bool flag[(2000005)];
Graph() { memset(head, -1, sizeof(head)), sz = 0; }
void push(int a, int b) { nxt[sz] = head[a], to[sz] = b, head[a] = sz++; }
int operator[](const int a) const { return to[a]; }
} g;
int dep[(1000005)], c1[(1000005)], c2[(1000005)], odd_cnt;
void Dfs(int a, int pre) {
for (int i = g.head[a]; ~i; i = g.nxt[i])
if (!dep[g[i]]) {
dep[g[i]] = dep[a] + 1, Dfs(g[i], i);
c1[a] += c1[g[i]], c2[a] += c2[g[i]];
g.c1[i] = c1[g[i]], g.c2[i] = c2[g[i]];
g.flag[i] = 1;
} else if (i != (pre ^ 1) && dep[g[i]] <= dep[a]) {
if (a == g[i]) {
if (i & 1) g.c1[i]++, odd_cnt++;
continue;
}
if ((dep[a] - dep[g[i]]) & 1)
c2[a]++, c2[g[i]]--, g.c2[i]++;
else
c1[a]++, c1[g[i]]--, g.c1[i]++, odd_cnt++;
}
}
vector<int> ans;
int main(int argc, char const* argv[]) {
IN(n), IN(m);
for (int i = 1, a, b; i <= m; i += 1)
IN(a), IN(b), g.push(a, b), g.push(b, a);
for (int i = 1; i <= n; i += 1)
if (!dep[i]) dep[i] = 1, Dfs(i, -1);
if (!odd_cnt) {
printf("%d\n", m);
for (int i = 1; i <= m; i += 1) printf("%d ", i);
putchar(10);
return 0;
}
for (int i = 0; i < g.sz; i += 1)
if (g.flag[i]) {
if (!g.c2[i] && g.c1[i] == odd_cnt) ans.push_back((i >> 1) + 1);
} else if (odd_cnt == 1 && g.c1[i])
ans.push_back((i >> 1) + 1);
printf("%lu\n", ans.size());
for (int i = 0; i < ans.size(); i += 1) printf("%d ", ans[i]);
putchar(10);
return 0;
}
| 11 | CPP |
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
if(b < 0) a *= -1, b *= -1;
return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
if(b < 0) a *= -1, b *= -1;
return a>0 ? (a-1)/b+1 : a/b;
}
constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 200010;
int n, m, K, d, a[100];
double ans;
void dfs(int cur){
if(cur == n){
int sum = 0;
rep(i, n) sum += a[i];
ans += 1.0 * max(1, sum-K) / d;
return;
}
For(i, 1, m+1){
a[cur] = i;
dfs(cur+1);
}
}
int main(){
while(scanf("%d%d%d", &n, &m, &K) && n){
d = 1;
rep(_, n) d *= m;
ans = 0;
dfs(0);
printf("%.20lf\n", ans);
}
}
| 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, s[300005];
int em, e[300005 * 2], nx[300005 * 2], ls[300005];
void read(int &x) {
x = 0;
char ch = getchar();
for (; ch < '0' || ch > '9'; ch = getchar())
;
for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
void write(int x) {
static int d[100];
if (!x)
putchar('0');
else {
while (x) d[++d[0]] = x % 10, x /= 10;
while (d[0]) putchar('0' + d[d[0]--]);
}
putchar('\n');
}
void insert(int x, int y) {
em++;
e[em] = y;
nx[em] = ls[x];
ls[x] = em;
em++;
e[em] = x;
nx[em] = ls[y];
ls[y] = em;
}
int tot, dfn[300005], sz[300005], g[300005], Idfn[300005], dep[300005],
top[300005], fa[300005];
struct Hash {
long long p, mo, f[300005], g[300005], mul[300005];
void build(long long _p, long long _mo) {
p = _p, mo = _mo;
mul[0] = 1;
for (i = 1; i <= n; i++) mul[i] = mul[i - 1] * p % mo;
for (int i = 1; i <= n; i++) f[i] = (f[i - 1] * p + s[Idfn[i]]) % mo;
for (int i = n; i >= 1; i--) g[i] = (g[i + 1] * p + s[Idfn[i]]) % mo;
}
long long get(int l, int r) {
if (l <= r) return (f[r] - f[l - 1] * mul[r - l + 1]) % mo;
return (g[r] - g[l + 1] * mul[l - r + 1]) % mo;
}
int check(int l0, int r0, int l1, int r1) {
return (get(l0, r0) - get(l1, r1)) % mo == 0;
}
} hs1, hs2;
void dfs1(int x, int p) {
dep[x] = dep[p] + 1, sz[x] = 1, fa[x] = p;
for (int i = ls[x]; i; i = nx[i])
if (e[i] != p) {
dfs1(e[i], x), sz[x] += sz[e[i]];
if (!g[x] || sz[e[i]] > sz[g[x]]) g[x] = e[i];
}
}
void dfs2(int x, int p) {
if (x == 1) top[x] = x;
dfn[x] = ++tot, Idfn[tot] = x;
if (g[x]) top[g[x]] = top[x], dfs2(g[x], x);
for (int i = ls[x]; i; i = nx[i])
if (e[i] != g[x] && e[i] != p) top[e[i]] = e[i], dfs2(e[i], x);
}
int l[2][300005], r[2][300005], cnt[2], len[2][300005], d[2][300005];
void getlca(int x, int y, int tp) {
static int tmp[300005][2], cntt;
cntt = 0, cnt[tp] = 0;
while (top[x] != top[y]) {
if (dep[top[x]] > dep[top[y]])
cnt[tp]++, l[tp][cnt[tp]] = dfn[x], r[tp][cnt[tp]] = dfn[top[x]],
x = fa[top[x]];
else
cntt++, tmp[cntt][0] = dfn[top[y]], tmp[cntt][1] = dfn[y], y = fa[top[y]];
}
cnt[tp]++, l[tp][cnt[tp]] = dfn[x], r[tp][cnt[tp]] = dfn[y];
while (cntt)
cnt[tp]++, l[tp][cnt[tp]] = tmp[cntt][0], r[tp][cnt[tp]] = tmp[cntt][1],
cntt--;
for (int i = 1; i <= cnt[tp]; i++)
len[tp][i] = len[tp][i - 1] + abs(r[tp][i] - l[tp][i]) + 1;
for (int i = 1; i <= cnt[tp]; i++) d[tp][i] = (r[tp][i] > l[tp][i]) ? 1 : -1;
}
int doit() {
static int id[2];
id[0] = id[1] = 0;
while (id[0] < cnt[0] && id[1] < cnt[1]) {
int t = (len[1][id[1] + 1] < len[0][id[0] + 1]);
if (len[t][id[t] + 1] == len[t ^ 1][id[t ^ 1]]) {
id[t]++;
continue;
}
int L[2], R[2];
for (int k = 0; k < 2; k++) {
if (len[k ^ 1][id[k ^ 1]] > len[k][id[k]])
L[k] = l[k][id[k] + 1] +
d[k][id[k] + 1] * (len[k ^ 1][id[k ^ 1]] - len[k][id[k]]);
else
L[k] = l[k][id[k] + 1];
R[k] = l[k][id[k] + 1] +
d[k][id[k] + 1] * (len[t][id[t] + 1] - len[k][id[k]] - 1);
}
if (hs1.check(L[0], R[0], L[1], R[1]) && hs2.check(L[0], R[0], L[1], R[1]))
id[t]++;
else {
int lenl = 0, lenr = abs(R[0] - L[0]), mid, mx = -1;
while (lenl <= lenr) {
mid = (lenl + lenr) >> 1;
if (hs1.check(L[0], L[0] + mid * d[0][id[0] + 1], L[1],
L[1] + mid * d[1][id[1] + 1]))
mx = mid, lenl = mid + 1;
else
lenr = mid - 1;
}
return max(len[0][id[0]], len[1][id[1]]) + mx + 1;
}
}
return max(len[0][id[0]], len[1][id[1]]);
}
int main() {
read(n);
char ch = getchar();
while (ch < 'a' || ch > 'z') ch = getchar();
for (i = 1; i <= n; i++) s[i] = ch - 'a' + 1, ch = getchar();
for (i = 1; i < n; i++) read(j), read(k), insert(j, k);
dfs1(1, 0), dfs2(1, 0);
hs1.build(29, 1000000009);
hs2.build(31, 998244353);
read(m);
while (m--) {
int x, y, xx, yy;
read(x), read(y), read(xx), read(yy);
getlca(x, y, 0), getlca(xx, yy, 1);
write(doit());
}
}
| 11 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n;
long long s[100007], sum[100007];
int q;
int calc(long long x) {
if (x < s[1]) return 0;
if (x >= s[n]) return n;
int lx = 1, rx = n;
while (rx - lx > 1) {
int mid = (lx + rx) / 2;
if (s[mid] <= x)
lx = mid;
else
rx = mid;
}
if (s[rx] <= x)
return rx;
else
return lx;
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%lld", &s[i]);
sort(s + 1, s + n + 1);
for (int i = 1; i < n; i++) s[i] = s[i + 1] - s[i];
s[n] = 1000000000000000007LL;
sort(s + 1, s + n + 1);
sum[0] = 0LL;
for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + s[i];
scanf("%d", &q);
while (q--) {
long long lx, rx;
scanf("%lld%lld", &lx, &rx);
long long x = rx - lx + 1;
int tmp = calc(x);
long long ans = sum[tmp] + 1LL * x * (n - tmp);
printf("%lld\n", ans);
}
return 0;
}
| 10 | CPP |
#include<bits/stdc++.h>
using namespace std;
int n, a[3][3];
bool b[3][3];
bool f(){
for(int i = 0; i < 3; ++i) if(b[i][0]&&b[i][1]&&b[i][2]) return true;
for(int j = 0; j < 3; ++j) if(b[0][j]&&b[1][j]&&b[2][j]) return true;
if(b[0][0]&&b[1][1]&&b[2][2]) return true;
if(b[0][2]&&b[1][1]&&b[2][0]) return true;
return false;
}
int main(){
for(int i = 0; i < 3; ++i) for(int j = 0; j < 3; ++j) cin >> a[i][j];
cin >> n;
int x;
for(int i = 0; i < n; ++i){
cin >> x;
for(int j = 0; j < 3; ++j) for(int k = 0; k < 3; ++k) if(a[j][k]==x) b[j][k] = true;
}
cout << (f()?"Yes":"No") << endl;
} | 0 | CPP |
y = int(input())
def beautiful(y):
x = str(y)
l = [x[0],x[1],x[2],x[3]]
s = set(l)
if len(s)==4:
return(True)
else:
return(False)
x = y
for i in range(y+1,10000):
x += 1
if beautiful(x):
print(x)
break
| 7 | PYTHON3 |
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int N;
void chmax(int &a,int b){
if(a<b) a=b;
}
void solve(){
vector<int> w(N);
for(int i=0;i<N;i++) cin>>w[i];
int dp[303][303]={};
for(int i=0;i<N-1;i++){
if(abs(w[i]-w[i+1])<=1) dp[i][i+1]=2;
}
for(int k=3;k<=N;k++){
for(int i=0;i+k-1<N;i++){
int lef=i;
int rig=i+k-1;
for(int j=lef;j<rig;j++){
chmax(dp[lef][rig],dp[lef][j]+dp[j+1][rig]);
}
if(abs(w[lef]-w[rig])<=1&&dp[lef+1][rig-1]==(k-2)) dp[lef][rig]=k;
}
}
cout<<dp[0][N-1]<<endl;
}
int main(){
while(1){
cin>>N;
if(N==0) break;
solve();
}
return 0;
}
| 0 | CPP |
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int kotae;
int func(int t[],int pre){
if(pre==0)
return 1;
for(int i=0;i<10;i++){
if(t[i]>=3){
t[i]-=3;
if(func(t,pre-3))
return 1;
t[i]+=3;
}else if(t[i]>=1&&t[i+1]>=1&&t[i+2]>=1){
t[i]-=1;t[i+1]-=1;t[i+2]-=1;
if(func(t,pre-3))
return 1;
t[i]+=1;t[i+1]+=1;t[i+2]+=1;
}
}
return 0;
}
//0 1 2 3 4 5 6 7 8 9 0 0
//1 2 3 4 5 6 7 8 9 10 11 12
int main(){
//r g b
int t[3][11],n,num[9],e[3];
char ch[9];
cin>>n;
while(n--){
e[0]=e[1]=e[2]=0;
for(int i=0;i<3;i++)
memset(t,0,sizeof(t));
for(int i=0;i<9;i++)
cin>>num[i];
for(int i=0;i<9;i++)
cin>>ch[i];
for(int i=0;i<9;i++){
if(ch[i]=='G'){
e[1]++;
t[1][num[i]-1]++;
}else if(ch[i]=='B'){
e[2]++;
t[2][num[i]-1]++;
}else if(ch[i]=='R'){
e[0]++;
t[0][num[i]-1]++;
}
}
kotae=0;
for(int i=0;i<3;i++){
if(e[i]%3!=0)
break;
if(func(t[i],e[i]))
kotae=kotae+e[i]/3;
}
if(kotae==3)
cout<<1<<endl;
else cout<<0<<endl;
}
return 0;
} | 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
int N, K;
int ans[100010];
int main() {
cin >> N >> K;
if (N == K) {
for (int i = 1; i <= N; i++) putchar('0');
puts("");
} else {
int p = (N - K) / 2;
int res = p;
for (int i = 1; i <= N; i++) {
if (res)
--res, putchar('0');
else
res = p, putchar('1');
}
puts("");
}
return 0;
}
| 8 | CPP |
n, k = map(int, input().split())
l = 0
r = 10 ** 12 + 1
while r - l > 1:
d = (r + l) // 2
if n // (d*k + d) >= 2:
l = d
else:
r = d
d = l
g = d * k
sh = n - g - d
print(d, g, sh) | 7 | PYTHON3 |
S = input()
T = input()
if T in S+S:
print("Yes")
else:
print("No") | 0 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T prod(const T &a, const T &b, const T &mod) {
return ((a % mod) * (b % mod)) % mod;
}
template <typename T>
T pow_(const T &a, const T &b) {
if (!b) return 1;
T p = pow_(a, b / 2);
p *= p;
return (b % 2) ? (p * a) : p;
}
template <typename T>
T modpow(const T &a, const T &b, const T &mod) {
if (!b) return 1;
T p = modpow(a, b / 2);
p = prod(p, p);
return (b % 2) ? (prod(p, a)) : p;
}
template <typename T>
T max(const T &a, const T &b, const T &c) {
return max(a, max(b, c));
}
template <typename T>
T min(const T &a, const T &b, const T &c) {
return min(a, min(b, c));
}
template <typename T>
void dbg(const vector<T> &a, int l, int r) {
for (long long int i = l; i <= r; i++) cout << a[i] << " ";
cout << endl;
}
template <typename T>
void dbg(const vector<T> &a) {
for (long long int i = 0; i <= a.size() - 1; i++) cout << a[i] << " ";
cout << endl;
}
vector<long long int> p(((long long int)3e5 + 1) + 1);
long long int n;
void dbg(priority_queue<long long int, vector<long long int>,
greater<long long int> >
a) {
while (!a.empty()) {
cout << a.top() << " ";
a.pop();
}
cout << endl;
}
void main_() {
scanf("%lld", &n);
for (long long int i = 0; i <= n - 1; i++) scanf("%lld", &p[i]);
priority_queue<long long int, vector<long long int>, greater<long long int> >
pq;
long long int ans = 0;
for (long long int i = 0; i <= n - 1; i++) {
if (!pq.empty() && pq.top() < p[i]) {
ans += (p[i] - pq.top());
pq.pop();
pq.push(p[i]);
}
pq.push(p[i]);
}
printf("%lld\n", ans);
}
int main() {
{ main_(); }
return 0;
}
| 11 | CPP |
/*
* Author: FreeIdea
* Created Time: 2011/8/22 12:39:40
* File Name: k.cpp
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}
int r, c;
/*其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对其实我也不知道对不对
*/
int main() {
while(scanf("%d%d", &r, &c) == 2) {
if(r == 0 && c == 0) break;
if((r * c) % 2) printf("no\n");
else printf("yes\n");
}
return 0;
}
| 0 | CPP |
n=int(input())
t=[int(x) for x in input().split()]
t1=t.count(1)
t2=t.count(2)
t3=t.count(3)
w=min(t1,t2,t3)
T1=[]
T2=[]
T3=[]
for i in range (n):
if t[i]==1:
T1.append(i+1)
elif t[i]==2:
T2.append(i+1)
else:
T3.append(i+1)
print(w)
if w!=0:
for i in range(w):
print(T1[i],T2[i],T3[i]) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int const N = 100000 + 10;
int n;
long double x, y;
struct Angle {
long double ag;
int flag;
} ang[N];
bool cmp(Angle a, Angle b) { return a.ag < b.ag; }
int main() {
while (~scanf("%d", &n)) {
for (int i = 0; i < n; i++) {
cin >> x >> y;
ang[i].ag = atan2(y, x);
ang[i].flag = i + 1;
}
sort(ang, ang + n, cmp);
long double m = 2 * acos(-1);
int m1 = 0, m2 = 0;
for (int i = 0; i < n; i++) {
long double tmp = ang[(i + 1) % n].ag - ang[i].ag;
if (tmp < 0) tmp += 2 * acos(-1);
if (tmp < m) {
m = tmp;
m1 = ang[i].flag;
m2 = ang[(i + 1) % n].flag;
}
}
printf("%d %d\n", m1, m2);
}
}
| 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long d1, d2, d3;
cin >> d1 >> d2 >> d3;
long long x = d1 + d2 + d3;
x = min(x, d1 + d1 + d2 + d2);
x = min(x, d1 + d1 + d3 + d3);
x = min(x, d2 + d2 + d3 + d3);
cout << x << endl;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long read() {
char c;
long long w = 1;
while ((c = getchar()) > '9' || c < '0')
if (c == '-') w = -1;
long long ans = c - '0';
while ((c = getchar()) >= '0' && c <= '9')
ans = (ans << 1) + (ans << 3) + c - '0';
return ans * w;
}
long long n, mod, K, X;
struct node {
long long next, to;
} e[1000005];
long long cnt;
long long h[1000005];
void add(long long x, long long y) {
cnt++;
e[cnt].next = h[x];
h[x] = cnt;
e[cnt].to = y;
}
long long vis[1000005];
long long mp[1000005];
long long core;
long long size[1000005];
long long c[1000005];
long long dep[1000005];
long long Km[1000005];
long long Kn[1000005];
long long ksm(long long x, long long y) {
long long ans = 1;
while (y) {
if (y & 1) ans *= x, ans %= mod;
x *= x;
x %= mod;
y >>= 1;
}
return ans;
}
void getc(long long x, long long all, long long d, long long y) {
size[x] = 1;
dep[x] = d;
mp[x] = 0;
for (long long i = h[x]; i; i = e[i].next) {
if (e[i].to == y) continue;
if (vis[e[i].to]) continue;
getc(e[i].to, all, d + 1, x);
size[x] += size[e[i].to];
mp[x] = max(size[e[i].to], mp[x]);
}
mp[x] = max(mp[x], all - size[x]);
if (!core || mp[x] < mp[core]) core = x;
}
map<long long, long long> m1, m2;
long long rt;
vector<long long> f, g1, g2;
long long in[1000005];
long long out[1000005];
void dfs(long long x, long long v1, long long v2, long long y) {
f.push_back(x);
v1 *= K;
v1 += c[x];
v1 %= mod;
v2 += Km[dep[x]] * c[x];
v2 %= mod;
if (dep[x] == 0) v2 = 0;
m2[v2]++;
long long o = (X - v1 + mod) * Kn[dep[x]] % mod;
g1.push_back(o);
m1[o]++;
g2.push_back(v2);
for (long long i = h[x]; i; i = e[i].next) {
if (!vis[e[i].to] && e[i].to != y) dfs(e[i].to, v1, v2, x);
}
}
void ad(long long op) {
for (long long i = 0; i < f.size(); i++) {
out[f[i]] += op * m2[g1[i]];
in[f[i]] += op * m1[g2[i]];
}
}
void solve(long long x, long long all) {
core = 0;
getc(x, all, 0, 0);
rt = core;
getc(rt, all, 0, 0);
if (all == 1) {
if (c[rt] % mod == X) in[rt]++, out[rt]++;
return;
}
m1.clear();
m2.clear();
vis[rt] = 1;
f.clear();
g1.clear();
g2.clear();
dfs(rt, 0, 0, 0);
ad(1);
for (long long i = h[rt]; i; i = e[i].next) {
if (!vis[e[i].to]) {
f.clear();
g1.clear();
g2.clear();
m1.clear();
m2.clear();
dfs(e[i].to, c[rt], 0, 0);
ad(-1);
}
}
for (long long i = h[rt]; i; i = e[i].next) {
if (!vis[e[i].to]) solve(e[i].to, size[e[i].to]);
}
}
long long p[34500];
signed main() {
n = read();
mod = read();
K = read();
X = read();
long long ni = ksm(K, mod - 2);
Km[0] = 1;
Kn[0] = 1;
for (long long i = 1; i <= n; i++) Km[i] = Km[i - 1] * K % mod;
for (long long i = 1; i <= n; i++) Kn[i] = Kn[i - 1] * ni % mod;
for (long long i = 1; i <= n; i++) c[i] = read();
for (long long i = 1; i < n; i++) {
long long a, b;
a = read();
b = read();
add(a, b);
add(b, a);
}
solve(1, n);
long long t = 0;
for (long long i = 1; i <= n; i++) {
long long in1 = n - in[i];
long long out1 = n - out[i];
t += 2ll * (in[i] * in1) + 2ll * (out[i] * out1) + in[i] * out1 +
in1 * out[i];
}
cout << n * n * n - (t >> 1) << endl;
return 0;
}
| 11 | CPP |
n = int(input())
l = list(map(int, input().split()))
ans = pow(10, 9)
for i in range(n):
ans = min(ans, l[i]*15+sum(list(map(int, input().split())))*5)
print(ans) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int tc;
cin >> tc;
while (tc--) {
long long int n, k;
cin >> n >> k;
vector<int> a(n), b(n);
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
ans += a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for (int i = 0; i < k; i++) {
if (a[i] >= b[n - i - 1]) {
break;
}
ans -= a[i];
ans += b[n - i - 1];
}
cout << ans << endl;
}
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 9;
long long n, k, a[N], mx, mx2;
void solve() {
cin >> n >> k;
mx = mx2 = -0x3f3f3f3f;
for (long long i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] > mx) mx = a[i];
}
for (long long i = 1; i <= n; i++) {
a[i] = mx - a[i];
if (a[i] > mx2) mx2 = a[i];
}
if (k & 1) {
for (long long i = 1; i <= n; i++) cout << a[i] << " ";
cout << '\n';
} else {
for (long long i = 1; i <= n; i++) cout << mx2 - a[i] << " ";
cout << '\n';
}
return;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
long long T;
cin >> T;
while (T--) solve();
return 0;
}
| 8 | CPP |
n, s = map(int, input().split())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
s -= 1
flag = False
if(first[0] == 0):
flag = True
print("NO")
if(not flag):
if(first[s] == 1):
print("YES")
elif(second[s] == 0):
print("NO")
else:
aux = False
for i in range(s, n):
if(first[i] == 1 and second[i] == 1):
aux = True
if(aux):
print("YES")
else:
print("NO") | 7 | PYTHON3 |
n=int(input());l1=[]
for _ in range(n):
l1.append([int(x) for x in input().split()])
p=((l1[0][1]*l1[0][2])//l1[1][2])**0.5;print(int(p),end=" ")
for i in range(1,n):
print(int(l1[0][i]//p),end=" ") | 8 | PYTHON3 |
n = int(input())
m=list(map(int,input().split()))
from collections import Counter
d=Counter(m)
t=0
f=0
s=0
e=0
for i in d:
if d[i]>=8:
e+=1
elif d[i]>=6:
s+=1
elif d[i]>=4:
f+=1
elif d[i]>=2:
t+=1
for x in range(int(input())):
c=input().split()
if c[0]=='+':
k=int(c[1])
d[k]+=1
if d[k]==6:
s+=1
f-=1
elif d[k]==2:
t+=1
elif d[k]==4:
t-=1
f+=1
elif d[k]==8:
s-=1
e+=1
else:
k=int(c[1])
if d[k]==2:
t-=1
elif d[k]==4:
t+=1
f-=1
elif d[k]==6:
s-=1
f+=1
elif d[k]==8:
e-=1
s+=1
d[k]-=1
#print(d,t,f,s)
if e>0:
print('YES')
elif f>=2:
print('YES')
elif s>0 and s+t+f>=2:
print('YES')
elif s==0 and (f>0 and f+t>=3):
print('YES')
else:
print('NO')
| 8 | PYTHON3 |
from operator import itemgetter
from collections import defaultdict
n,m= map(int,input().split())
dicta=defaultdict(list)
details=[]
for i in range(n):
participant = input().split()
participant[1]=int(participant[1])
participant[2]=int(participant[2])
details.append(participant)
details.sort(key=itemgetter(1,2))
for j in range(n):
dicta[details[j][1]].append([details[j][0],details[j][2]])
for key in dicta.keys():
valu=len(dicta[key])
if len(dicta[key])!=2 and dicta[key][valu-2][1]==dicta[key][valu-3][1]:
print("?")
else:
print("{} {}".format(dicta[key][valu-1][0],dicta[key][valu-2][0])) | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
bool isequal(string& a, string& b) {
if (a.size() != b.size()) return false;
if (a == b) return true;
if (a.size() % 2) return false;
string ah = string(a.begin(), a.begin() + a.size() / 2);
string al = string(a.begin() + a.size() / 2, a.end());
string bh = string(b.begin(), b.begin() + b.size() / 2);
string bl = string(b.begin() + b.size() / 2, b.end());
return (isequal(ah, bl) && isequal(al, bh)) ||
(isequal(ah, bh) && isequal(al, bl));
}
int main() {
string a, b;
cin >> a >> b;
cout << (isequal(a, b) ? "YES" : "NO");
return 0;
}
| 10 | CPP |
a=[1,0,0,0,1,0,1,0,2,1,1,2,0,1,0,0]
n=int(input())
c=0
while True:
k=n%16
c+=a[int(k)]
n/=16
n=int(n)
if n==0:
break
print(c)
| 8 | PYTHON3 |
t=int(input())
for _ in range(0,t):
n=int(input())
if(n%2!=0):
print(n//2)
else:
ans=n//2
ans=ans-1
print(ans)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
int n;
int x[N], y[N];
set<int> s;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &x[i]);
s.insert(y[i]);
}
for (int i = 0; i < n; i++) {
scanf("%d", &y[i]);
s.insert(y[i]);
}
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s.count(x[i] ^ y[j])) ans++;
}
}
if (ans & 1) {
printf("Koyomi");
} else {
printf("Karen\n");
}
return 0;
}
| 7 | CPP |
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
using namespace std;
template<typename Monoid>
struct SegmentTree {
using F = function<Monoid(Monoid, Monoid)>;
const F f;
const Monoid M1;
int sz;
vector<Monoid> dat;
SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
sz = 1;
while (sz < n) sz <<= 1;
dat.assign(sz * 2, M1);
}
void set(int k, const Monoid &x) { dat[k + sz] = x; }
void build() {
for (int k = sz - 1; k > 0; k--) {
dat[k] = f(dat[2 * k], dat[2 * k + 1]);
}
}
void update(int k, const Monoid &x) {
dat[k += sz] = x;
while (k >>= 1) dat[k] = f(dat[2 * k], dat[2 * k + 1]);
}
Monoid get(int a, int b) { // [a, b)
Monoid L = M1, R = M1;
for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
if (a & 1) L = f(L, dat[a++]);
if (b & 1) R = f(dat[--b], R);
}
return f(L, R);
}
Monoid operator[](const int &k) const { return dat[k + sz]; }
friend ostream& operator<<(ostream& os, SegmentTree<Monoid> &seg) {
for (int i = 0; i < seg.sz; i++) os << seg[i] << " ";
return os;
}
};
int main() {
const int MAX = 1e5;
int n; cin >> n;
vector<int> a(n);
for (int &ai: a) cin >> ai;
using P = pair<int, long long>;
auto f = [](const P &a, const P &b) { return max(a, b); };
SegmentTree<P> seg(MAX + 1, f, {0, 0});
for (int ai: a) {
auto p = seg.get(0, ai);
seg.update(ai, max(seg[ai], {p.first + 1, p.second + ai}));
}
cout << seg.get(0, MAX + 1).second << endl;
return 0;
}
| 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
int break_point() {
char c;
while ((c = getchar()) != '\n')
;
return 0;
}
template <typename T>
void read_integer(T &r) {
bool sign = 0;
r = 0;
char c;
while (1) {
c = getchar();
if (c == '-') {
sign = 1;
break;
}
if (c != ' ' && c != '\n') {
r = c - '0';
break;
}
}
while (1) {
c = getchar();
if (c == ' ' || c == '\n') break;
r = r * 10 + (c - '0');
}
if (sign) r = -r;
}
long long binpowmod(long long a, long long b, long long mod) {
if (b == 0) return 1;
long long c = binpowmod(a, b >> 1, mod);
return (((c * c) % mod) * (b & 1 ? a : 1)) % mod;
}
long long binpow(long long a, long long b) {
if (b == 0) return 1;
long long c = binpow(a, b >> 1);
return c * c * (b & 1 ? a : 1);
}
inline int getbit(int x, int b) { return (x >> b) & 1; }
inline int setbit(int x, int b) { return x | (1 << b); }
inline void _setbit(int &x, int b) { x = setbit(x, b); }
inline long long setbit(long long x, int b) { return x | (1ll << b); }
inline void _setbit(long long &x, int b) { x = setbit(x, b); }
inline int unsetbit(int x, int b) { return x & (INT_MAX - (1 << b)); }
inline void _unsetbit(int &x, int b) { x = unsetbit(x, b); }
inline int countbit(int x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
inline long long countbit(long long x) {
return countbit(int(x & INT_MAX)) + countbit(int(x >> 32) & INT_MAX);
}
inline void printbit(int x, int len) {
for (int i = len - 1; i >= 0; i--) printf("%d", getbit(x, i));
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
template <typename A, typename B>
ostream &operator<<(ostream &stream, const pair<A, B> &p) {
stream << "{" << p.first << "," << p.second << "}";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const vector<A> &v) {
stream << "[";
for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
stream << "]";
return stream;
}
template <typename A, typename B>
ostream &operator<<(ostream &stream, const map<A, B> &v) {
stream << "[";
for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
stream << "]";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const set<A> &v) {
stream << "[";
for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
stream << "]";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const stack<A> &v) {
stack<A> st = v;
stream << "[";
while (!st.empty()) {
stream << st.top() << " ";
st.pop();
}
stream << "]";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const priority_queue<A> &v) {
priority_queue<A> q = v;
stream << "[";
while (!q.empty()) {
stream << q.top() << " ";
q.pop();
}
stream << "]";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const queue<A> &v) {
queue<A> q = v;
stream << "[";
while (!q.empty()) {
stream << q.front() << " ";
q.pop();
}
stream << "]";
return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const deque<A> &v) {
deque<A> q = v;
stream << "[";
while (!q.empty()) {
stream << q.front() << " ";
q.pop_front();
}
stream << "]";
return stream;
}
void run();
int main() {
srand(time(NULL));
do {
run();
if (0) {
0 ? printf("-------------------------------\n") : 0;
0 ? printf("-------------------------------\n") : 0;
}
} while (0);
return 0;
}
int d[55][55];
int p[55][55];
void run() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for (int i = 0; i < 55; ++i) d[i][0] = d[0][i] = 100000;
d[0][1] = 0;
vector<pair<int, int> > v;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1);
p[i][j] = d[i][j] == d[i - 1][j] + 1 ? 1 : 2;
v.push_back({i, j});
}
}
sort(v.begin(), v.end(),
[](const pair<int, int> &a, const pair<int, int> &b) {
return d[a.first][a.second] < d[b.first][b.second];
});
int res = 0;
stack<pair<int, int> > st;
for (int i = 0; i < k; i++) {
res += d[v[i].first][v[i].second];
st.push({-1, -1});
pair<int, int> x = v[i];
while (x.first != 0) {
st.push(x);
x = p[x.first][x.second] == 1 ? std::make_pair(x.first - 1, x.second)
: std::make_pair(x.first, x.second - 1);
}
}
printf("%d\n", res);
while (!st.empty()) {
auto x = st.top();
st.pop();
if (x.first == -1)
putchar('\n');
else
printf("(%d,%d) ", x.first, x.second);
}
}
| 10 | CPP |
n = int(input())
lengt = len(str(n))
d = max ( int(n) - int(9*lengt), 0 )
j = 0
r = []
def sum_digits(a):
return sum(list(map(int, str(a))))
if ( n == 1 or n == 3 or n == 5 or n == 7 or n == 9):
print ('0')
else:
for i in range (d, n):
if ( (i+ sum_digits(i)) == n):
j += 1
r.append(i)
print (j)
for k in r:
print (k)
| 9 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
if (s[0] > '4' && s[0] != '9') s[0] = (char)(9 - (s[0] - 48) + 48);
for (int i = 1; i < s.length(); i++) {
if (s[i] > '4') s[i] = (char)(9 - (s[i] - 48) + 48);
}
cout << s;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
struct point {
int x, y, ind;
char ch;
};
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
long long res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long fact[13];
void factorial() {
fact[0] = 1;
for (long long i = 1; i < 12; i++) fact[i] = (fact[i - 1] * i);
}
bool cmp(point A, point B) {
if (A.x != B.x) return A.x < B.x;
return A.y < B.y;
}
long long n, m, _, __, ans;
string st, tp, t1, t2;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cout << setprecision(12);
cin >> st;
bool ok = true;
for (long long i = 0; i < st.size(); i++)
if (st[i] == '0') {
ok = false;
st.erase(i, 1);
break;
}
if (ok) st.erase(st.size() - 1);
cout << st << "\n";
return 0;
}
| 9 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n;
cin >> t;
while (t--) {
cin >> n;
vector<int> arr(n);
vector<int> dp(n);
for (int i = 0; i < n; i++) cin >> arr[i];
dp[n - 1] = 1;
for (int i = n - 2; i >= 0; i--) {
if (arr[i] == 1) {
if (dp[i + 1])
dp[i] = 0;
else
dp[i] = 1;
} else
dp[i] = 1;
}
if (dp[0])
cout << "First";
else
cout << "Second";
cout << "\n";
}
return 0;
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &num) {
T x = 0, f = 1;
char ch = getchar();
for (; ch > '9' || ch < '0'; ch = getchar())
if (ch == '-') f = -1;
for (; ch <= '9' && ch >= '0'; ch = getchar())
x = (x << 3) + (x << 1) + (ch ^ '0');
num = x * f;
}
int ttt, n, a[200005], b[30], stk[200005], stk2[200005];
char s[200005];
int main() {
read(ttt);
a[0] = 114514;
while (ttt--) {
scanf("%s", s + 1);
n = strlen(s + 1);
for (int i = 1; i <= n; i++) a[i] = s[i] - 'a';
int ff = 0, mx = 0;
for (int i = 0; i < 26; i++) b[i] = 0;
for (int i = 2; i <= n; i++) {
if (a[i] == a[i - 1]) ff++, b[a[i]]++;
}
for (int i = 0; i < 26; i++) mx = max(mx, b[i]);
printf("%d\n", max((ff + 1) >> 1, mx) + 1);
int t1 = 0, t2 = 0;
for (int i = 1; i <= n; i++) {
stk[++t1] = a[i];
if (a[i] != a[i - 1]) continue;
if (!t2 || stk[t1] == stk[stk2[t2]]) {
stk2[++t2] = t1;
continue;
}
mx = 0;
for (int c = 0; c < 26; c++)
if (b[c] > b[mx]) mx = c;
if (b[mx] * 2 < ff || stk[t1] == mx || stk[stk2[t2]] == mx) {
ff -= 2;
b[stk[t1]]--;
b[stk[stk2[t2]]]--;
printf("%d %d\n", stk2[t2], t1 - 1);
stk[stk2[t2]] = stk[t1];
t1 = stk2[t2];
--t2;
} else
stk2[++t2] = t1;
}
for (int lst = t1, i = t1; i; i--) {
if (i == 1 || stk[i - 1] == stk[i])
printf("%d %d\n", i, lst), lst = i - 1;
}
}
return 0;
}
| 10 | CPP |
import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))
n,k,d = I()
st=0;ct=0
if n<=k:
for i in range(d):
for j in range(n):
print(j+1,end=" ")
print("")
exit()
an=[[0]*n for i in range(d)]
tp=1;s=0
for i in range(d):
tp*=k
if tp>=n:
s=1;break
if s:
st=0
def conv(x):
p=[]
while x:
p.append(x%k)
x//=k
p=[0]*(d-len(p))+p[::-1]
return p
for i in range(n):
s=conv(st)
for j in range(d-1,-1,-1):
an[j][i]=s[j]+1
st+=1
for i in range(d):
print(*an[i])
else:
print(-1) | 9 | PYTHON3 |
a,b=map(int,input().split())
l=list(map(int,input().split()))
import itertools
b=min(b,50)
def ku(l):
y=[0]*a
for j,x in enumerate(l):
y[max(0,j-x)]+=1
r=min(j+x,a-1)
if r<a-1:
y[r+1]-=1
return itertools.accumulate(y)
for _ in range(b):
l=ku(l)
print(*l) | 0 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5000;
int qps[MAX_N], qbs[MAX_N], ps[MAX_N], bs[MAX_N];
bool used[MAX_N];
int query(int i, int j) {
printf("? %d %d\n", i, j);
fflush(stdout);
int r;
scanf("%d", &r);
return r;
}
bool check(int n, int b0) {
fill(used, used + n, false);
for (int i = 0; i < n; i++) {
ps[i] = qps[i] ^ b0;
if (used[ps[i]]) return false;
used[ps[i]] = true;
bs[ps[i]] = i;
}
for (int i = 0; i < n; i++)
if ((ps[i] ^ bs[0]) != qps[i] || (ps[0] ^ bs[i]) != qbs[i]) return false;
return true;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) qps[i] = query(i, 0);
qbs[0] = qps[0];
for (int i = 1; i < n; i++) qbs[i] = query(0, i);
int c = 0, cb0 = -1;
for (int b0 = 0; b0 < n; b0++)
if (check(n, b0)) c++, cb0 = b0;
check(n, cb0);
printf("!\n%d\n", c);
for (int i = 0; i < n; i++) printf("%d%c", ps[i], (i + 1 < n) ? ' ' : '\n');
return 0;
}
| 10 | CPP |
n,q=map(int,input().split())
ans=[]
while(q):
a,b=map(int,input().split())
x=(a-1)*n+b+1
if (a+b)%2 !=0:
x=x+n*n
ans.append(str(x//2))
q=q-1
print("\n".join(ans)) | 8 | PYTHON3 |
n, q = input(), 0
for i in range(len(n)):
if n[i] in ('4', '7'):
q += 1
if q in (4, 7):
print('YES')
else:
print('NO')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, k, l, c, d, p, nl, np, ans = 0, m_d = 0, t = 0, li = 0, s = 0;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
m_d = k * l;
t = m_d / nl;
li = c * d;
s = p / np;
ans = min(min(t, li), s) / n;
cout << ans;
}
| 7 | CPP |
#2分探索
#md/cで交点が定まらない時の対案
n,k = map(int, input().split( ))
m = [tuple(map(int, input().split( ))) for i in range(n)]
#そもそも設定はn枚すべて焼く必要はない
mx = 10**15
mn = 0
from math import sqrt
def solve(x1, y1, r1, x2, y2, r2):
rr0 = (x2 - x1)**2 + (y2 - y1)**2
xd = x2 - x1
yd = y2 - y1
rr1 = r1**2; rr2 = r2**2
cv = (rr0 + rr1 - rr2)
if max(r1,r2,sqrt(rr0))*2>r1+r2+sqrt(rr0):
return (x1,y1),(x2,y2)
sv = sqrt(4*rr0*rr1 - cv**2)
return (
(x1 + (cv*xd - sv*yd)/(2.*rr0), y1 + (cv*yd + sv*xd)/(2.*rr0)),
(x1 + (cv*xd + sv*yd)/(2.*rr0), y1 + (cv*yd - sv*xd)/(2.*rr0)),
)
#flag で breakしてたのが煩雑すぎて追えていなかったらしい
while mx-mn>10**(-6) and mx-mn>10**(-7)*mx:#mx大きい時に安易に設定すると到達しない?
md = (mx+mn)/2
cnt = 0
for i in range(n):##中心選ぶケースが抜けてる
pi0,pi1 = m[i][0],m[i][1]
tmp = 0
for l in range(n):#kはすでに使っている変数
if m[l][2]*sqrt(((pi0-m[l][0])**2) + ((pi1-m[l][1])**2))<=md+0.000000001:
tmp += 1
if cnt<tmp:
cnt = tmp
for i in range(n):
for j in range(i+1,n):##range(i)だとi=0で止まって何もしない
p = solve(m[i][0],m[i][1],md/m[i][2], m[j][0],m[j][1],md/m[j][2])
for pi in p:
tmp = 0
for l in range(n):#kはすでに使っている変数
if (((pi[0]-m[l][0])**2) + ((pi[1]-m[l][1])**2))**(1/2)<=md/m[l][2]+0.000000001:##ここで誤差認めなかったせいらしい
tmp += 1
if cnt<tmp:
cnt = tmp
if cnt>=k:
mx = md
else:
mn = md
print(mx)
| 0 | PYTHON3 |
#include <stdio.h>
#include <string.h>
#define a 0
#define b 1
#define c 2
#define d 3
#define e 4
#define f 5
#define g 6
#define h 7
#define i 8
int main(void) {
int status[9][9];
int n, I, J;
char s[1000];
char ch;
int flag = 0;
status[a][0] = 2;
status[a][1] = b;
status[a][2] = d;
status[b][0] = 3;
status[b][1] = a;
status[b][2] = c;
status[b][3] = e;
status[c][0] = 2;
status[c][1] = b;
status[c][2] = f;
status[d][0] = 3;
status[d][1] = a;
status[d][2] = e;
status[d][3] = g;
status[e][0] = 4;
status[e][1] = b;
status[e][2] = d;
status[e][3] = f;
status[e][4] = h;
status[f][0] = 3;
status[f][1] = c;
status[f][2] = e;
status[f][3] = i;
status[g][0] = 2;
status[g][1] = d;
status[g][2] = h;
status[h][0] = 3;
status[h][1] = g;
status[h][2] = e;
status[h][3] = i;
status[i][0] = 2;
status[i][1] = f;
status[i][2] = h;
n = 1000;
while (n--) {
flag = 1;
scanf("%s", s);
ch = s[0];
for (I = 1; strlen(s) >=2 &&I < strlen(s); I++) {
for (J = 1; J <= status[ch - 'A'][0]; J++) {
if (status[ch - 'A'][J] == s[I]-'A') break;
}
if (J == status[ch - 'A'][0] + 1) {
flag = 0; break;
}
if (I != strlen(s) - 1)ch = s[I];
}
if (flag == 1) printf("%s\n", s);
}
return 0;
} | 0 | CPP |
t=int(input())
for i in range(t):
n=int(input())
if n>30 and n!=36 and n!=40 and n!=44:
a=30
print('YES')
print(6, 10, 14, n-a)
elif n<=30:
print('NO')
elif n==36:
print('YES')
print(6, 10, 15, 5)
elif n==40:
print('YES')
print(6, 10, 15, 9)
elif n==44:
print('YES')
print(6, 10, 15, 13) | 7 | PYTHON3 |
# using python 3
def solution(d, initial, final):
if initial == final :
return 0
sum_dis = sum(d)
temp = initial
temp2 = final
initial = min(temp, temp2) -1
final = max(temp,temp2) -1
dis = sum(d[initial : final])
return min(sum_dis - dis , dis)
n = int(input())
d = list(map(int, input().split()))
initial , final = list(map(int, input().split()))
print(solution(d, initial, final))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
inline int getInt() {
int x;
scanf("%d", &x);
return x;
}
inline long long getLL() {
long long x;
scanf("%lld", &x);
return x;
};
inline int NUM(char c) { return (int)c - 48; }
inline char CHR(int n) { return (char)(n + 48); }
template <class T>
inline T MAX(T a, T b) {
if (a > b) return a;
return b;
}
template <class T>
inline T MIN(T a, T b) {
if (a < b) return a;
return b;
}
template <class T>
inline T ABS(T a) {
if (a < 0) return -a;
return a;
}
inline void OPEN(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
long long BPM(long long a, long long b, long long MOD) {
if (a == 0) return 0;
if (b == 0) return 1;
if (b % 2 == 0) {
long long x = BPM(a, b / 2, MOD);
return x * x % MOD;
}
return a * BPM(a, b - 1, MOD) % MOD;
}
long long cnt(long long X, long long P, long long MOD) {
if (P == 0) return 1;
long long tmp = cnt(X * X % MOD, P - 1, MOD);
return (tmp + tmp * X % MOD) % MOD;
}
long long MOD;
long long K, L, R;
int main() {
int nTC;
cin >> nTC;
while (nTC--) {
cin >> K >> L >> R >> MOD;
if (MOD == 2 && K % 2 == 1) {
cout << 0 << endl;
} else if (MOD == 2) {
cout << 1 << endl;
} else {
long long b = BPM(2, L, MOD - 1);
long long X = BPM(K % MOD, b, MOD);
long long p = BPM(2, R - L + 1, MOD - 1);
long long ret;
if (X == 0)
ret = 1;
else if (X == 1)
ret = BPM(2, R - L + 1, MOD);
else {
ret = (BPM(X, p, MOD) - 1 + MOD) % MOD;
ret *= (BPM((MOD + (X - 1) % MOD) % MOD, MOD - 2, MOD));
ret %= MOD;
}
if (K % 2 == 1) {
ret = ret * BPM(BPM(2, MOD - 2, MOD), R - L, MOD) % MOD;
}
cout << ret << endl;
}
}
return 0;
}
| 10 | CPP |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll fast_pow(ll a, ll b, ll m) {
ll res = 1;
while (b > 0) {
if (b & 1) res = (res * a) % m;
a = (a * a) % m;
b = b / 2;
}
return res;
}
template <typename T, typename U>
std::pair<T, U> operator-(const std::pair<T, U>& l, const std::pair<T, U>& r) {
return {l.first - r.first, l.second - r.second};
}
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
return {l.first + r.first, l.second + r.second};
}
const ll maxn = 1e5 + 10LL;
const ll inf = 1e9 + 10LL;
vector<int> prefix_function(string s) {
int n = (int)s.length();
vector<int> pi(n);
for (int i = 1; i < n; i++) {
int j = pi[i - 1];
while (j > 0 && s[i] != s[j]) j = pi[j - 1];
if (s[i] == s[j]) j++;
pi[i] = j;
}
return pi;
}
int main() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> ans;
int ctr = 0;
bool a = true;
while (ctr < n - 1) {
if (s[ctr] == 'W' && s[ctr + 1] == 'W') {
ans.push_back(ctr + 1);
s[ctr] = 'B';
s[ctr + 1] = 'B';
ctr += 2;
} else if (s[ctr] == 'W' && s[ctr + 1] == 'B') {
s[ctr] = 'B';
s[ctr + 1] = 'W';
ans.push_back(ctr + 1);
ctr++;
} else {
ctr++;
}
}
if (s[n - 1] == 'W') {
ctr = n - 3;
while (ctr >= 0) {
if (s[ctr] == 'B' && s[ctr + 1] == 'B') {
s[ctr] = 'B';
s[ctr + 1] = 'B';
ans.push_back(ctr + 1);
}
ctr -= 2;
}
}
if (n % 2 == 0 && s[n - 1] == 'W') a = false;
if (a) {
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
cout << endl;
} else {
cout << -1 << endl;
}
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long f[20][50][255];
int a[20], b[2550], c[255][10] = {0};
int gcd(int a, int b) {
while (a ^= b ^= a ^= b %= a)
;
return b;
}
int lc(int a, int b) { return a * b / gcd(a, b); }
long long dfs(int p, int s, int l, bool t) {
if (!p) return l % s == 0;
if (!t && f[p][b[s]][l] >= 0) return f[p][b[s]][l];
int end = t ? a[p] : 9;
long long ans = 0;
for (int i = 0; i <= end; i++)
ans += dfs(p - 1, i ? lc(s, i) : s, p == 1 ? l * 10 + i : c[l][i],
i == end & t);
if (!t) f[p][b[s]][l] = ans;
return ans;
}
long long se(long long x) {
int po = 0;
for (; x; x /= 10) a[++po] = x % 10;
return dfs(po, 1, 0, 1);
}
int main() {
memset(f, -1, sizeof(f));
for (int j = 0, i = 1; i <= 2520; i++) b[i] = 2520 % i ? 0 : ++j;
for (int j = 0; j < 10; j++)
for (int i = 0; i < 252; i++) c[i][j] = (i * 10 + j) % 252;
int t;
long long x, y;
scanf("%d", &t);
while (t--) {
scanf("%lld%lld", &x, &y);
printf("%lld\n", se(y) - se(x - 1));
}
}
| 10 | CPP |
def split(word):
return [char for char in word]
a=split(input())
b=split(input())
c=split(input())
if len(a)+len(b)-len(c) != 0:
print("NO")
else:
for i in c:
if c.count(i)!=a.count(i)+b.count(i):
print("NO")
break
else:
print("YES") | 7 | PYTHON3 |
for i in range(int(input())):
x,y,t,s=map(int,input().split())
r=y-x
w=t+s
if r%w==0:
print(int(r//w))
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, i, j, c = 0, s = 0;
cin >> n >> k;
int a[n + 1];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < n - 1; i++) {
if (a[i] != a[i + 1]) {
c++;
} else {
if (c >= s) {
s = c;
}
c = 0;
}
}
if (c >= s) {
s = c;
}
cout << s + 1 << endl;
}
| 20 | CPP |
n=int(input())
for i in range(n+1):
input()
if n%2==0:
print("home")
else:
print("contest") | 7 | PYTHON3 |
n=int(input())
s=[]
count=0
for i in range(n):
s.append(input())
if s[i]=="Tetrahedron":
count+=4
elif s[i]=="Cube":
count+=6
elif s[i]=="Octahedron":
count+=8
elif s[i]=="Dodecahedron":
count+=12
else:
count+=20
print(int(count)) | 7 | PYTHON3 |
for i in range(int(input())):
a,b,n,m=map(int,input().split())
if a+b>=n+m:
if min(a,b)>=m:
print("Yes")
else:
print("No")
else:
print("No") | 9 | PYTHON3 |
init_ts = ["SS", "SW", "WS", "WW"]
def notanim(t):
if t=="S":
return "W"
else:
return "S"
def nextAnimal(ts, s):
if ts[1]=="S":
if s=="o":
return ts[0]
else:
return notanim(ts[0])
elif ts[1]=="W":
if s=="o":
return notanim(ts[0])
else:
return ts[0]
def maket(n, s, init_t):
t = init_t
new_s = s[1:] + s[0]
for i in range(n):
t += nextAnimal(t[-2:], new_s[i])
return t
n = int(input())
s = input()
flag = True
for init_t in init_ts:
tmp_t = maket(n, s, init_t)
if tmp_t[-2:]==init_t:
print(tmp_t[:-2])
flag = False
break
else:
pass
if flag:
print(-1)
| 0 | PYTHON3 |
queries = int(input())
for _ in range(queries):
_ = input()
array = [int(value) for value in input().split()]
array.sort(reverse=True)
result = [str(item) for item in array]
print(' '.join(result)) | 8 | PYTHON3 |
n = int(input())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
a = n * [0]
for i in range(n):
if s1[i] == s2[i]:
a[i] = s1[i]
if a.count(0) == 2:
if s1[a.index(0)] not in s2 and s2[n - a[::-1].index(0) - 1] not in s1:
a[a.index(0)] = s1[a.index(0)]
a[a.index(0)] = s2[a.index(0)]
elif s2[a.index(0)] not in s1 and s1[n - a[::-1].index(0) - 1] not in s2:
a[a.index(0)] = s2[a.index(0)]
a[a.index(0)] = s1[a.index(0)]
else:
ans = 0
for i in range(1, n + 1):
if s1[a.index(0)] != i and s2[a.index(0)] != i and i not in a:
a[a.index(0)] = i
break
print(*a)
| 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
int ev = 0, od = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] % 2 == 0)
ev++;
else
od++;
}
if (ev >= od)
cout << od;
else {
int ans = ev;
int remod = od - ev;
ans += (remod) / 3;
cout << ans;
}
}
| 13 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long nd(long long x) {
long long cnt = 0;
while (x > 0) {
x = x / 10;
cnt++;
}
return cnt;
}
long long sd(long long x) {
long long sum = 0;
while (x > 0) {
sum += x % 10;
x = x / 10;
}
return sum;
}
long long sds(string s) {
long long ans = 0;
for (long long i = 0; i < s.length(); i++) {
ans += s[i] - 48;
}
return ans;
}
long long nf(long long x) { return (x / 9) + 1; }
long long n, m;
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
cin >> n >> m;
if (m <= 18 && n <= 18) {
for (long long i = n; i < 100; i++) {
for (long long j = i + 1; j < 100; j++) {
if (sd(i) >= n && sd(j) >= n && sd(i + j) <= m) {
cout << i << '\n';
cout << j << '\n';
return 0;
}
}
}
}
for (long long i = 0; i < 2000; i++) cout << 8;
cout << 9;
cout << '\n';
for (long long i = 0; i <= 2000; i++) {
cout << 1;
}
return 0;
}
| 8 | CPP |
def inp(dtype=str, strip=True):
s = input()
res = [dtype(p) for p in s.split()]
res = res[0] if len(res) == 1 and strip else res
return res
def problem1():
n = inp(int)
a = inp(int, strip=False)
m = inp(int)
b = inp(int, strip=False)
union = set(a + b)
for k1 in a:
for k2 in b:
if k1 + k2 not in union:
print(k1, k2)
return
def problem2():
n = inp(int)
a = inp(int, strip=False)
res = 0
has0 = False
negs = 0
for k in a:
if k < 0:
negs += 1
if k == 0:
has0 = True
res += 1
else:
res += abs(k) - 1
if negs % 2 == 1 and not has0:
res += 2
print(res)
def problem3():
n = int(input().strip())
if n % 2 == 0:
print('NO')
else:
a = [0 for _ in range(2 * n)]
for i in range(2 * n):
offset = n if i % 4 in [1, 2] else 0
pos = offset + (i // 2)
# print(pos)
a[pos] = i + 1
print('YES')
print(' '.join([str(el) for el in a]))
def problem4():
pass
if __name__ == '__main__':
# problem1()
# problem2()
problem3()
# problem4()
| 9 | PYTHON3 |
#include<cstdio>
int n, ans;
int s[101111];
int main() {
scanf("%d", &n);
ans = 0;
for(int i=0;i<n;i++) {
int x; scanf("%d", &x);
if (x<=n) s[x]++; else ans++;
}
for(int i=1;i<=n;i++)
if(s[i] >= i) ans += s[i]-i;
else ans += s[i];
printf("%d\n", ans);
return 0;
} | 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int U[1 << 10][1 << 10];
int D[1 << 10][1 << 10];
int L[1 << 10][1 << 10];
int R[1 << 10][1 << 10];
int D1[1 << 10][1 << 10];
int D2[1 << 10][1 << 10];
int D3[1 << 10][1 << 10];
int D4[1 << 10][1 << 10];
char c[1 << 10][1 << 10];
long double s1[1 << 10][1 << 10];
long double s2[1 << 10][1 << 10];
long double d1[1 << 10][1 << 10];
long double d2[1 << 10][1 << 10];
int main(void) {
int n;
ios_base ::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> (c[i] + 1);
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
long double val = c[i][j] == '0' ? -70 : log(c[i][j] - '0');
s1[i][j] = s1[i - 1][j] + val;
s2[i][j] = s2[i][j - 1] + val;
d1[i][j] = d1[i - 1][j - 1] + val;
}
for (int i = n; i; --i)
for (int j = 1; j <= n; ++j) {
long double val = c[i][j] == '0' ? -70 : log(c[i][j] - '0');
d2[i][j] = d2[i + 1][j - 1] + val;
}
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
U[i][j] = c[i][j] == '0' ? 0 : U[i - 1][j] + 1;
D1[i][j] = c[i][j] == '0' ? 0 : D1[i - 1][j - 1] + 1;
}
for (int i = 1; i <= n; ++i)
for (int j = n; j; --j) {
R[i][j] = c[i][j] == '0' ? 0 : R[i][j + 1] + 1;
D2[i][j] = c[i][j] == '0' ? 0 : D2[i - 1][j + 1] + 1;
}
for (int i = n; i; --i)
for (int j = n; j; --j) {
D[i][j] = c[i][j] == '0' ? 0 : D[i + 1][j] + 1;
D3[i][j] = c[i][j] == '0' ? 0 : D3[i + 1][j + 1] + 1;
}
for (int i = n; i; --i)
for (int j = 1; j <= n; ++j) {
L[i][j] = c[i][j] == '0' ? 0 : L[i][j - 1] + 1;
D4[i][j] = c[i][j] == '0' ? 0 : D4[i + 1][j - 1] + 1;
}
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
--U[i][j], --D[i][j], --L[i][j], --R[i][j], --D1[i][j], --D2[i][j],
--D3[i][j], --D4[i][j];
pair<pair<long double, int>, pair<int, int> > ans = {{-500, 0}, {0, 0}};
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
if (c[i][j] != '0') {
int l1 = min({L[i][j], R[i][j], U[i][j], D[i][j]});
int l2 = min({D1[i][j], D2[i][j], D3[i][j], D4[i][j]});
ans = max(ans, {{s1[i + l1][j] - s1[i - l1 - 1][j] + s2[i][j + l1] -
s2[i][j - l1 - 1] - log(c[i][j] - '0'),
0},
{i, j}});
ans = max(ans, {{d1[i + l2][j + l2] - d1[i - l2 - 1][j - l2 - 1] -
d2[i + l2 + 1][j - l2 - 1] + d2[i - l2][j + l2] -
log(c[i][j] - '0'),
1},
{i, j}});
}
if (ans.first.first <= -50) {
cout << (0) << '\n';
exit(0);
};
int rs = 1;
if (!ans.first.second) {
int a = ans.second.first, b = ans.second.second;
int l = min({L[a][b], R[a][b], U[a][b], D[a][b]});
for (int i = 1; i <= l; ++i)
rs = (rs * 1ll * (c[a - i][b] - '0') * (c[a + i][b] - '0') *
(c[a][b - i] - '0') * (c[a][b + i] - '0')) %
mod;
rs = (1ll * rs * (c[a][b] - '0')) % mod;
{
cout << (rs) << '\n';
exit(0);
};
} else {
int a = ans.second.first, b = ans.second.second;
int l = min({D1[a][b], D2[a][b], D3[a][b], D4[a][b]});
for (int i = 1; i <= l; ++i)
rs = (rs * 1ll * (c[a - i][b - i] - '0') * (c[a - i][b + i] - '0') *
(c[a + i][b - i] - '0') * (c[a + i][b + i] - '0')) %
mod;
rs = (1ll * rs * (c[a][b] - '0')) % mod;
{
cout << (rs) << '\n';
exit(0);
};
}
return 0;
}
| 11 | CPP |
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first
const int MX = 605;
const int MM = 1000000007;
int C[MX][MX];
ll I[MX], FI[MX], F[MX];
int A[MX], sz = 0;
string S;
ll ans = 1;
int N, K;
int pr[75] = {};
int sum = -1, t = 2;
void update()
{
if( N < sum ) return;
int cnt = 0, red = 0, blue = 0;
for(char c : S){
if( c == 'r' ){
if( red < sz) red++;
else cnt -= cnt>0;
}
else{
if( blue < red && A[blue] >= 2 ) cnt += A[blue++]-2;
else cnt -= cnt>0;
}
}
if(cnt || red != sz || A[blue] >= 2) return;
ll m = F[sz];
for(int i = 0; i < sz; i++) pr[A[i]] += 1;
for(int i = 0; i <= A[0]; i++){
if(pr[i]) m = m * FI[pr[i]] % MM;
pr[i] = 0;
}
ans = (ans + C[t+N-1][N-sum] * m) % MM;
}
void dfs(int K, int mx){
if( K == 0 ) return;
for(int i = mx; i >= 1; i--){
A[sz++] = i;
t += i >= 2 ? 2 : 0;
sum += i == 1 ? 2 : i*2-2;
update();
dfs(K-i, min(i, K-i));
A[--sz] = 0;
t -= i >= 2 ? 2 : 0;
sum -= i == 1 ? 2 : i*2-2;
}
}
int main()
{
F[0] = FI[0] = 1;
I[1] = 1;
for(int i = 2; i < MX; i++) I[i] = (MM-I[MM%i]) * (MM/i) % MM;
for(int i = 1; i < MX; i++) F[i] = F[i-1] * i % MM;
for(int i = 1; i < MX; i++) FI[i] = FI[i-1] * I[i] % MM;
scanf("%d%d", &N, &K);
for(int i = 0; i < MX; i++){
C[i][0] = 1;
for(int j = 1; j <= i; j++) C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MM;
}
cin >> S;
dfs(K, K);
printf("%lld\n", ans);
}
| 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
bool bysec(const pair<int, int>& a, const pair<int, int>& b) {
return (a.second < b.second);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, x;
cin >> n;
int arr[1000005];
for (int i = 1; i <= n; ++i) {
cin >> x;
arr[x] = i;
}
long long q, cntx = 0, cnty = 0;
cin >> q;
while (q--) {
cin >> x;
cntx += arr[x];
cnty += n - arr[x] + 1;
}
cout << cntx << " " << cnty << "\n";
return 0;
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
bool isprime(long long int n) {
if (n < 2) return false;
for (long long int i = 2; i <= sqrt(n); i++)
if (n % i == 0) return false;
return true;
}
long long gcd(long long int a, long long int b) {
if (a == 0 || b == 0)
return a + b;
else
return gcd(b, a % b);
}
void MAIN();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
MAIN();
return 0;
}
void MAIN() {
double n, x, y;
cin >> n >> x >> y;
int ans[4];
memset(ans, 0, sizeof(ans));
set<double> s;
for (long long int i = 0; i < n; i++) {
double xi, yi;
cin >> xi >> yi;
if (xi == x)
ans[0] = 1;
else if (yi == y)
ans[2] = 1;
else {
s.insert((yi - y) / (xi - x));
}
}
int res = 0;
for (long long int i = 0; i < 4; i++)
if (ans[i]) res++;
cout << res + (long long int)(s).size();
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
struct node {
int l, r, tag, x, y;
} T[N << 2];
void pushup(int rt) {
T[rt].x = min(T[rt << 1].x, T[rt << 1 | 1].x);
T[rt].y = max(T[rt << 1].y, T[rt << 1 | 1].y);
}
void pushdown(int rt) {
if (!T[rt].tag) return;
T[rt << 1].x -= T[rt].tag, T[rt << 1 | 1].x -= T[rt].tag;
T[rt << 1].y += T[rt].tag, T[rt << 1 | 1].y += T[rt].tag;
T[rt << 1].tag += T[rt].tag, T[rt << 1 | 1].tag += T[rt].tag;
T[rt].tag = 0;
}
void build(int rt, int l, int r) {
T[rt].l = l, T[rt].r = r;
if (l == r) return T[rt].x = T[rt].y = l, void();
int mid = (l + r) >> 1;
build(rt << 1, l, mid), build(rt << 1 | 1, mid + 1, r), pushup(rt);
}
void update(int rt, int start, int end) {
int l = T[rt].l, r = T[rt].r, mid = (l + r) >> 1;
if (start <= l && r <= end) return T[rt].tag++, T[rt].x--, T[rt].y++, void();
pushdown(rt);
if (start <= mid) update(rt << 1, start, end);
if (end > mid) update(rt << 1 | 1, start, end);
pushup(rt);
}
int find(int rt) {
int l = T[rt].l, r = T[rt].r, mid = (l + r) >> 1;
if (T[rt].y < 0) return -1e9;
if (l == r) return l;
pushdown(rt);
if (T[rt << 1].y >= 0) return find(rt << 1);
return find(rt << 1 | 1);
}
int query(int rt, int start) {
int l = T[rt].l, r = T[rt].r, mid = (l + r) >> 1;
if (start <= l) return T[rt].x;
pushdown(rt);
if (start > mid) return query(rt << 1 | 1, start);
return min(T[rt << 1 | 1].x, query(rt << 1, start));
}
int tree[N], mn, mx;
void upd(int x) {
for (x -= mn - 1; x <= mx - mn + 1; x += x & -x) tree[x]++;
}
int que(int x) {
int res = 0;
for (x -= mn - 1; x; x -= x & -x) res += tree[x];
return res;
}
int main() {
int n;
scanf("%d", &n), mn = 0, mx = 0;
vector<int> v;
for (int i = 1, a; i <= n; i++)
scanf("%d", &a), v.push_back(a), mn = min(mn, a), mx = max(mx, a);
build(1, mn, mx);
for (int i = 1; i <= n; i++) {
int a = v[i - 1];
update(1, a, 1e9), upd(a);
int pos = find(1);
if (pos == -1e9)
printf("%d\n", -i);
else {
int t = que(pos), tmp = max(pos, -t) + i - t, res = query(1, pos) + i;
printf("%d\n", min(tmp, res));
}
}
}
| 11 | CPP |
n, d = map(int, input().split())
h, count = list(map(int, input().split())), 0
for i in range(n - 1):
if h[i] + d == h[i + 1] - d:
count += 1
if h[i] + d < h[i + 1] - d:
count += 2
print(count + 2)
| 7 | PYTHON3 |
s=str(input())
a=s[0]
a=a.upper()
t=a+s[1:]
print(t) | 7 | PYTHON3 |
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
sun = a[0]
for i in range(n):
if i == n-1:
sun +=1
elif a[i+1]!=a[i]:
sun +=2 + abs(a[i]-a[i+1])
elif a[i+1] == a[i]:
sun +=2
print(sun) | 8 | PYTHON3 |
#include <iostream>
#include <string>
using namespace std;
int main()
{
while (true) {
string s1;
cin >> s1;
if (s1 == ".") {
break;
}
string s2;
cin >> s2;
if (s1 == s2) {
cout << "IDENTICAL" << endl;
continue;
}
string t1 = s1;
string t2 = s2;
while (true) {
size_t d1b = t1.find('\"'); // t1 start position
if (d1b == string::npos)
break;
t1.replace(d1b, 1, "@");
size_t d1e = t1.find('\"'); // t1 end position
t1.replace(d1e, 1, "@");
size_t d2b = t2.find('\"'); // t2 start position
if (d2b == string::npos)
break;
t2.replace(d2b, 1, "@");
size_t d2e = t2.find('\"'); // t2 end position
t2.replace(d2e, 1, "@");
string u1 = s1;
u1.replace(d1b + 1, d1e - d1b - 1, "");
string u2 = s2;
u2.replace(d2b + 1, d2e - d2b - 1, "");
if (u1 == u2) {
t1 = u1;
t2 = u2;
break;
}
}
if (t1 == t2) {
cout << "CLOSE" << endl;
}
else {
cout << "DIFFERENT" << endl;
}
}
return 0;
}
| 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
void FastIO() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
long long modpow(long long a, long long p, long long mod) {
long long ret = 1;
while (p) {
if (p & 1) ret = (ret * a) % mod;
a = (a * a) % mod;
p /= 2;
}
return ret;
}
long long power(long long a, long long p) {
long long ret = 1;
while (p) {
if (p & 1) ret = (ret * a);
a = (a * a);
p /= 2;
}
return ret;
}
int a[6];
int main() {
FastIO();
for (int i = 0; i < 6; i++) cin >> a[i];
cout << (a[0] + a[1] + a[2]) * (a[0] + a[1] + a[2]) - a[0] * a[0] -
a[2] * a[2] - a[4] * a[4]
<< '\n';
return 0;
}
| 7 | CPP |
n,c=map(int,input().split())
a=list(map(int,input().split()))
mx=a[0]-a[1]
for i in range(2,n):
mx=max(mx,a[i-1]-a[i])
print(max(0,mx-c)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
inline long long int max(long long int a, long long int b) {
return ((a > b) ? a : b);
}
inline long long int min(long long int a, long long int b) {
return ((a > b) ? b : a);
}
inline long long int gcd(long long int a, long long int b) {
if (b == 0) return a;
a %= b;
return gcd(b, a);
}
using namespace std;
long long int power(long long int a, long long int b) {
long long int res = 1;
a %= 1000000007;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1) res = res * a % 1000000007;
a = a * a % 1000000007;
}
return res;
}
long long int modInverse(long long int a) { return power(a, 1000000007 - 2); }
const int N = 500023;
struct HASH {
size_t operator()(const pair<int, int>& x) const {
return hash<long long>()(((long long)x.first) ^
(((long long)x.second) << 32));
}
};
bool compare(long long int x, long long int y) { return x > y; }
void solve() {
long long int n;
string s;
cin >> n >> s;
long long int l = 0, r = 0;
for (long long int i = 0; i < n; i++) {
if (s[i] == 'L') {
l++;
} else {
r++;
}
}
cout << l + r + 1;
cout << "\n";
return;
}
int main() {
{
ios ::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
int T = 1;
int t = 0;
while (t++ < T) {
solve();
}
cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
<< "ms\n";
}
| 7 | CPP |
mas = [0]*10
sticks = list(map(int,input().split()))
for i in sticks:
mas[i] += 1
#print(set(mas))
if set(mas) == {0,1,4} or set(mas)=={0,1,5}:
print('Bear')
elif set(mas) == {0,2,4} or set(mas)=={0,6}:
print('Elephant')
else:
print('Alien')
| 7 | PYTHON3 |
num = int(input())
s = [4, 7, 47, 74, 447, 474, 744, 477, 747, 774]
if any(num % i == 0 for i in s):
print('YES')
else:
print('NO') | 7 | PYTHON3 |
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
print ("YNEOS"[sum(x)<sum(y)::2]) | 7 | PYTHON3 |
n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*g*b
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k>=n: break
if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
ans-=1
print(ans)
| 0 | PYTHON3 |
num = 0
for _ in range(int(input())):
s = input()
if s[1] == '+':
num +=1
else:
num -=1
print(num) | 7 | PYTHON3 |
s = str(input())
if 1 <= len(s) <= 10000:
for i in range(0, len(s)):
s = s[0].upper()+s[1:]
print(s)
| 7 | PYTHON3 |
#include<bits/stdc++.h>
using namespace std;
int n,a[100010],b[100010],x[100010],ans,f[100010];
vector<int> g[100010];
map<pair<int,int>,int> mp;
void dfs(int deep,int color){
int c=1;
for (int i=0;i<g[deep].size();i++)
if (f[g[deep][i]]==0){
f[g[deep][i]]=1;
if (c==color) c++;
mp[pair<int,int>(g[deep][i],deep)]=c;
mp[pair<int,int>(deep,g[deep][i])]=c;
dfs(g[deep][i],c);
c++;
}
}
int main(){
cin>>n;
for (int i=0;i<n-1;i++){
cin>>a[i]>>b[i];
x[a[i]]++;x[b[i]]++;
g[a[i]].push_back(b[i]);
g[b[i]].push_back(a[i]);
}
for (int i=1;i<=n;i++) ans=max(ans,x[i]);
cout<<ans<<endl;f[1]=1;
dfs(1,-1);
for (int i=0;i<n-1;i++) cout<<mp[pair<int,int>(a[i],b[i])]<<endl;
return 0;
} | 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
static const int maxn = 1e5 + 5;
static const int maxb = 320;
vector<int> light_set[maxn];
vector<int> heavy_set[maxb];
int light_heavy_intersection[maxn][maxb];
int heavy_heavy_intersection[maxb][maxb];
int num_ele[maxn];
int mapper[maxn];
long long lazy[maxn];
long long ans_heavy[maxn];
long long arr[maxn];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, q;
cin >> n >> m >> q;
for (int i = 1; i <= n; i++) cin >> arr[i];
int light = 0;
int heavy = 0;
for (int i = 1; i <= m; i++) {
cin >> num_ele[i];
if (num_ele[i] > maxb) {
mapper[i] = ++heavy;
long long sum = 0;
heavy_set[heavy].resize(num_ele[i]);
for (int &x : heavy_set[heavy]) {
cin >> x;
sum += arr[x];
}
sort(heavy_set[heavy].begin(), heavy_set[heavy].end());
ans_heavy[heavy] = sum;
} else {
mapper[i] = ++light;
light_set[light].resize(num_ele[i]);
for (int &x : light_set[light]) cin >> x;
sort(light_set[light].begin(), light_set[light].end());
}
}
auto get = [&](vector<int> &vec, int key) {
auto fnd = lower_bound(vec.begin(), vec.end(), key);
return fnd != vec.end() && *fnd == key;
};
for (int lgt = 1; lgt <= light; lgt++) {
for (int x : light_set[lgt]) {
for (int hvy = 1; hvy <= heavy; hvy++)
light_heavy_intersection[lgt][hvy] += get(heavy_set[hvy], x);
}
}
for (int hvy = 1; hvy <= heavy; hvy++) {
for (int x : heavy_set[hvy]) {
for (int i = 1; i <= heavy; i++)
if (i != hvy) heavy_heavy_intersection[hvy][i] += get(heavy_set[i], x);
}
}
while (q--) {
char type;
cin >> type;
if (type == '?') {
int x;
cin >> x;
if (num_ele[x] > maxb) {
int hvy = mapper[x];
long long res = ans_heavy[hvy] + 1LL * num_ele[x] * lazy[hvy];
for (int i = 1; i <= heavy; i++)
if (hvy != i) res += heavy_heavy_intersection[hvy][i] * lazy[i];
cout << res << '\n';
} else {
int lgt = mapper[x];
long long res = 0;
for (int p : light_set[lgt]) res += arr[p];
for (int z = 1; z <= heavy; z++)
res += (light_heavy_intersection[lgt][z] * lazy[z]);
cout << res << '\n';
}
} else {
int x;
long long val;
cin >> x >> val;
if (num_ele[x] > maxb) {
int hvy = mapper[x];
lazy[hvy] += val;
} else {
int lgt = mapper[x];
for (int p : light_set[lgt]) arr[p] += val;
for (int hvy = 1; hvy <= heavy; hvy++)
ans_heavy[hvy] += (light_heavy_intersection[lgt][hvy] * val);
}
}
}
}
| 11 | CPP |
#include <iostream>
#include <string>
using namespace std;
int main() {
string num_str[11] = {
"0111111",
"0000110",
"1011011",
"1001111",
"1100110",
"1101101",
"1111101",
"0100111",
"1111111",
"1101111",
"0000000"
};
int n;
int num,num_prev;
string signal;
while(cin >> n) {
if(n==-1) break;
signal="0000000";
num_prev=10;
for(int i=0;i<n;i++) {
cin >> num;
for(int j=0;j<7;j++) {
signal[j]=((num_str[num_prev][j]-48)^(num_str[num][j]-48)+48);
}
num_prev=num;
cout << signal << endl;
}
}
return 0;
} | 0 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 3;
int dp[maxn][maxn][2];
int path[maxn][maxn][2];
int cal(int num, int typ) {
int tim = 0;
int bynum = typ == 0 ? 2 : 5;
while (!(num % bynum)) {
num /= bynum;
tim++;
}
return tim;
}
void fuck(int x, int y, int k) {
if (x == 1 && y == 1) return;
if (path[x][y][k] == 1) {
fuck(x - 1, y, k), putchar('D');
} else {
fuck(x, y - 1, k), putchar('R');
}
}
int main() {
int num, ori;
bool flag = false;
int onei, onej;
memset(dp, 0, sizeof(dp));
scanf("%d", &num);
for (int i = 2; i <= num; i++) {
dp[i][0][0] = dp[0][i][0] = dp[i][0][1] = dp[0][i][1] = 0x3f3f3f3f;
}
for (int i = 1; i <= num; i++) {
for (int j = 1; j <= num; j++) {
scanf("%d", &ori);
if (!ori)
flag = true, onei = i, onej = j;
else {
while (ori % 2 == 0) dp[i][j][0]++, ori /= 2;
while (ori % 5 == 0) dp[i][j][1]++, ori /= 5;
}
for (int k = 0; k < 2; k++) {
if (dp[i - 1][j][k] < dp[i][j - 1][k])
dp[i][j][k] += dp[i - 1][j][k], path[i][j][k] = 1;
else
dp[i][j][k] += dp[i][j - 1][k], path[i][j][k] = 2;
}
}
}
int kk = dp[num][num][0] > dp[num][num][1] ? 1 : 0;
int i;
if (flag && dp[num][num][kk] > 1) {
cout << "1\n";
for (i = 2; i <= onei; i++) putchar('D');
for (i = 2; i <= num; i++) putchar('R');
for (i = onei + 1; i <= num; i++) putchar('D');
return 0;
}
printf("%d\n", dp[num][num][kk]);
fuck(num, num, kk);
printf("\n");
return 0;
}
| 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int N, M;
int g[11][312][312];
int f[312][312], s[312][312];
int main() {
scanf("%d%d", &N, &M);
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j) g[0][i][j] = 1000002012;
for (int i = 1; i <= M; ++i) {
int x, y, c1, c2;
scanf("%d%d%d%d", &x, &y, &c1, &c2);
g[0][x][y] = -c1;
g[0][y][x] = -c2;
}
for (int p = 1; p <= 10; ++p) {
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j) g[p][i][j] = g[p - 1][i][j];
for (int k = 1; k <= N; ++k)
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j)
g[p][i][j] = min(g[p - 1][i][k] + g[p - 1][k][j], g[p][i][j]);
}
bool flag = 0;
for (int i = 1; i <= N; ++i)
if (g[10][i][i] < 0) flag = 1;
if (!flag) {
puts("0");
return 0;
}
int ans = 0;
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j)
if (i != j)
f[i][j] = 1000002012;
else
f[i][j] = 0;
int T = 2048;
for (int p = 10; p >= 0; --p) {
T = T >> 1;
bool flag = 0;
for (int i = 1; i <= N; ++i)
if (g[p][i][i] < 0) flag = 1;
if (flag) continue;
memcpy(s, f, sizeof(f));
for (int i = 1; i <= N; ++i)
for (int k = 1; k <= N; ++k)
for (int j = 1; j <= N; ++j)
s[i][j] = min(f[i][k] + g[p][k][j], s[i][j]);
flag = 0;
for (int i = 1; i <= N; ++i)
if (s[i][i] < 0) flag = 1;
if (!flag) {
ans += T;
memcpy(f, s, sizeof(s));
}
}
cout << ans + 1;
return 0;
}
| 8 | CPP |
from collections import deque
t = int(input())
for _ in range(t):
n = int(input())
arr = map(int,input().split())
de = deque(arr)
sumA = de.popleft()
sumB = 0
tempA = sumA
tempB = 0
moves = 1
while(de):
while tempB <= tempA and de:
tempB += de.pop()
sumB += tempB
moves += 1
tempA = 0
while tempA <= tempB and de:
tempA += de.popleft()
if de or tempA:
sumA += tempA
moves += 1
tempB = 0
print(moves,sumA,sumB)
| 10 | PYTHON3 |
n=input().split()
k=input().split()
p=int(n[1])
result=0
for i in k:
if int(i)>=int(k[p-1]) and i!='0':
result+=1
print(result)
| 7 | PYTHON3 |
Subsets and Splits