buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; long long ara[200003], tra[200003]; int main() { long long n, m, a, b, c, d, e, f, g, h, p, q, r, fr, sc, tr, sz, tz, i, j, k, mx = LLONG_MIN, mn = LLONG_MAX; long long x = 0, y = 0, cnt = 0, res = 0, ttl = 0, ans = 0, sum = 0; long long flg = 0, flag = 1, na...
#include <bits/stdc++.h> using namespace std; long long ara[200003], tra[200003]; int main() { long long n, m, a, b, c, d, e, f, g, h, p, q, r, fr, sc, tr, sz, tz, i, j, k, mx = LLONG_MIN, mn = LLONG_MAX; long long x = 0, y = 0, cnt = 0, res = 0, ttl = 0, ans = 0, sum = 0; long long flg = 0, flag = 1, na...
[["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
711
#include <bits/stdc++.h> using namespace std; #define int long long long long X[200200]; signed main() { int Ans = 0; int N, M, K; cin >> N >> M >> K; for (int i = 1; i <= N; i++) { cin >> X[i]; X[i] += X[i - 1]; } Ans = lower_bound(X + 1, X + N + 1, K) - X - 1; for (int i = 1; i <= M; i++) { ...
#include <bits/stdc++.h> using namespace std; #define int long long long long X[200200]; signed main() { int Ans = 0; int N, M, K; cin >> N >> M >> K; for (int i = 1; i <= N; i++) { cin >> X[i]; X[i] += X[i - 1]; } Ans = lower_bound(X + 1, X + N + 1, K + 1) - X - 1; for (int i = 1; i <= M; i++) { ...
[["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
197
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i)) int main() { int ans = 0; int N, M, K; cin >> N >> M >> K; vector<ll> A(N + 1, 0), B(M); rep(i, N) { cin >> A[i + 1]; } rep(i, M) { cin >> B[i]; } rep(i, N - 1) { A[i + 1] += A[i...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i)) int main() { int ans = 0; int N, M, K; cin >> N >> M >> K; vector<ll> A(N + 1, 0), B(M); rep(i, N) { cin >> A[i + 1]; } rep(i, M) { cin >> B[i]; } rep(i, N) { A[i + 1] += A[i]; }...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
227
#include <bits/stdc++.h> using namespace std; //#define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&a...
#include <bits/stdc++.h> using namespace std; //#define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&a...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
434
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; ll n, m, k, a[200001], b[200001], A, ans, L; vector<ll> v, u; int main(void) { cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; v.push_back(0); u.push_back(0); ...
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; ll n, m, k, a[200001], b[200001], A, ans, L; vector<ll> v, u; int main(void) { cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; v.push_back(0); u.push_back(0); ...
[["-", 0, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 69, 28, 22]]
1
256
/// Bismillahir Rahmanir Rahim #include "bits/stdc++.h" #define ll long long #define int ll #define fi first #define si second #define mp make_pair #define pb push_back #define pi pair<ll, ll> #define clr(x) memset(x, 0, sizeof(x)); #define f(i, l, r) for (int i = l; i <= r; i++) #define rf(i, r, l) for (int i = r; i ...
/// Bismillahir Rahmanir Rahim #include "bits/stdc++.h" #define ll long long #define int ll #define fi first #define si second #define mp make_pair #define pb push_back #define pi pair<ll, ll> #define clr(x) memset(x, 0, sizeof(x)); #define f(i, l, r) for (int i = l; i <= r; i++) #define rf(i, r, l) for (int i = r; i ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
306
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, m, k; cin >> n >> m >> k; vector<ll> a(n + 1), b(m + 1), prefa(m + 1), prefb(m + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; prefa[i] = pref...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, m, k; cin >> n >> m >> k; vector<ll> a(n + 1), b(m + 1), prefa(n + 1), prefb(m + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; prefa[i] = pref...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
362
N, M, K = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i) B = gets.chomp.split(" ").map(&:to_i) tt = 0 ia = 0 ib = 0 A.each do |a| break if tt + a > K tt += a ia += 1 end B.each do |b| break if tt + b > K tt += b ib += 1 end max_n = ia + ib while ia >= 0 ia -= 1 tt -= A[ia] if ...
N, M, K = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i) B = gets.chomp.split(" ").map(&:to_i) tt = 0 ia = 0 ib = 0 A.each do |a| break if tt + a > K tt += a ia += 1 end B.each do |b| break if tt + b > K tt += b ib += 1 end max_n = ia + ib while ia > 0 ia -= 1 tt -= A[ia] lo...
[["-", 36, 36, 0, 493, 0, 89, 15, 738, 17, 20], ["+", 36, 36, 0, 493, 0, 89, 15, 738, 17, 47], ["-", 8, 170, 0, 751, 8, 755, 12, 742, 500, 743], ["-", 8, 170, 0, 751, 8, 755, 12, 742, 0, 70], ["-", 8, 170, 0, 751, 8, 755, 12, 742, 0, 22], ["-", 8, 170, 0, 751, 8, 755, 12, 742, 0, 73], ["-", 0, 493, 0, 89, 8, 170, 0, 75...
4
174
# -*- coding: utf-8 -*- N,M,K=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) ans=0 T=0 for i in range(N): T+=A[i] if T > K: T-=A[i] break else: ans+=1 R=[] R.append(ans) n=ans-1 m=0 while(1): while(1): if m>=M: break T+...
# -*- coding: utf-8 -*- N,M,K=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) ans=0 T=0 for i in range(N): T+=A[i] if T > K: T-=A[i] break else: ans+=1 R=[] R.append(ans) n=ans m=0 while(1): while(1): if m>=M: break T+=B...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
181
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <ostream> #include <queue> #include <set> #include <stack> #include <time.h> using namespace std; #define rep(i, m, n) for (int i = m; i <= n; i++) #define mem(s...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <ostream> #include <queue> #include <set> #include <stack> #include <time.h> using namespace std; #define rep(i, m, n) for (int i = m; i <= n; i++) #define mem(s...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
441
#include <bits/stdc++.h> using namespace std; int64_t MOD = 1000000007; double PI = 3.141592653589793; int main() { int64_t N, M, K; cin >> N >> M >> K; vector<int64_t> A(N + 1), B(M + 1); int64_t tmp; for (int64_t i = 1; i < N + 1; i++) { cin >> tmp; if (i != 1) A[i] = A[i - 1] + tmp; els...
#include <bits/stdc++.h> using namespace std; int64_t MOD = 1000000007; double PI = 3.141592653589793; int main() { int64_t N, M, K; cin >> N >> M >> K; vector<int64_t> A(N + 1), B(M + 1); int64_t tmp; for (int64_t i = 1; i < N + 1; i++) { cin >> tmp; if (i != 1) A[i] = A[i - 1] + tmp; els...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
242
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) index = 0 index2 = 0 stackedTime = 0 while(index<N and stackedTime + A[index] <= K): stackedTime += A[index] index += 1 while(index2 < M and stackedTime + B[index2] <= K): stackedTime += B[index2] ind...
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) index = 0 index2 = 0 stackedTime = 0 while(index<N and stackedTime + A[index] <= K): stackedTime += A[index] index += 1 while(index2 < M and stackedTime + B[index2] <= K): stackedTime += B[index2] ind...
[["-", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22]]
5
184
/* vrrtll==???>;::::~~~~~~......`.`````````````````````...-?777!_.._?7u,~~~::::;>>??=lllttrrzu rtll==??>>;::::~~~~......`.`````````````````` ..J77!`````````...`..._T,~~~~:::;;>??==lttrrv tll=??>>;:::~~~~......``````````````````..J7^ ` `` ` `` .,```````...._4,.~~~::;;>>?===lttr l=???>;;::~~~......`````HTSu,.`` `..J7! ...
/* vrrtll==???>;::::~~~~~~......`.`````````````````````...-?777!_.._?7u,~~~::::;>>??=lllttrrzu rtll==??>>;::::~~~~......`.`````````````````` ..J77!`````````...`..._T,~~~~:::;;>??==lttrrv tll=??>>;:::~~~~......``````````````````..J7^ ` `` ` `` .,```````...._4,.~~~::;;>>?===lttr l=???>;;::~~~......`````HTSu,.`` `..J7! ...
[["-", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22]]
1
1,086
# -*- coding: utf-8 -*- import sys import math import os import itertools import string import heapq import _collections from collections import Counter from collections import defaultdict from collections import deque from functools import lru_cache import bisect import re import queue import decimal class Scanner()...
# -*- coding: utf-8 -*- import sys import math import os import itertools import string import heapq import _collections from collections import Counter from collections import defaultdict from collections import deque from functools import lru_cache import bisect import re import queue import decimal class Scanner()...
[["+", 0, 14, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
375
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
[["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25]]
1
496
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) int main() { int M, N, K; cin >> N >> M >> K; vector<long long> A(N + 1, 0), B(M + 1, 0); FOR(i, 1, N) cin >> A[i]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) int main() { long long M, N, K; cin >> N >> M >> K; vector<long long> A(N + 1, 0), B(M + 1, 0); FOR(i, 1, N + 1) c...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
246
#include <iostream> using namespace std; int main() { int N, M; long K; cin >> N >> M >> K; int A[N + 10], B[M + 10]; for (int i = 1; i <= N; i++) { cin >> A[i]; } for (int i = 1; i <= M; i++) { cin >> B[i]; } int count_A = 0; long total_time = 0; for (int i = 1; i <= N; i++) { if (t...
#include <iostream> using namespace std; int main() { int N, M; long K; cin >> N >> M >> K; int A[N + 10], B[M + 10]; for (int i = 1; i <= N; i++) { cin >> A[i]; } for (int i = 1; i <= M; i++) { cin >> B[i]; } int count_A = 0; long total_time = 0; for (int i = 1; i <= N; i++) { if (t...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
251
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = (ll)1e10; int main() { ll N, M, K; cin >> N >> M >> K; ll comA[N + 2], comB[M + 2]; comA[0] = 0; comA[N + 1] = INF; comB[0] = 0; comB[M + 1] = INF; for (ll i = 1; i <= N; i++) { ll a; cin >> a; comA[i] = co...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = (ll)1e10; int main() { ll N, M, K; cin >> N >> M >> K; ll comA[N + 2], comB[M + 2]; comA[0] = 0; comA[N + 1] = INF; comB[0] = 0; comB[M + 1] = INF; for (ll i = 1; i <= N; i++) { ll a; cin >> a; comA[i] = co...
[["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22]]
1
316
N,M,K=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) A=[0]+A B=[0]+B from itertools import accumulate AA=list(accumulate(A)) BB=list(accumulate(B)) a,b=0,0 import bisect for i in range(N+1): a=i b=bisect.bisect_right(BB,K-AA[i])-1 if b==-1: continue ...
N,M,K=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) A=[0]+A B=[0]+B from itertools import accumulate AA=list(accumulate(A)) BB=list(accumulate(B)) count=0 a,b=0,0 import bisect for i in range(N+1): a=i b=bisect.bisect_right(BB,K-AA[i])-1 if b==-1: cont...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
148
// author rhythmicankur // god_is_almighty #pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> #define f first #define s second #define int long long #define ll int #define ld long double #define pb push_back #define eb emplace_back #define mk make_pair #define vi vector<int> #define pii pair...
// author rhythmicankur // god_is_almighty #pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> #define f first #define s second #define int long long #define ll int #define ld long double #define pb push_back #define eb emplace_back #define mk make_pair #define vi vector<int> #define pii pair...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
695
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n, m, k; long long a[200005]; long long b[200005]; long long suma[200005]; long long sumb[200005]; bool canread(int num) { bool ans = false; for (int i = 0; i < num; i++) { int j = num - i; // Aからi冊 Bからj冊読めるか...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n, m, k; long long a[200005]; long long b[200005]; long long suma[200005]; long long sumb[200005]; bool canread(int num) { bool ans = false; for (int i = 0; i <= num; i++) { int j = num - i; // Aからi冊 Bからj冊読める...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
264
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right,bisect n,m,k=map(int,stdin.readline().split()) a=list(map(int,stdin.readline().split())) b=list(map(int,stdin.readline().split())) prea=[] ans=0 for i in a: ans+=i prea....
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right,bisect n,m,k=map(int,stdin.readline().split()) a=list(map(int,stdin.readline().split())) b=list(map(int,stdin.readline().split())) prea=[] ans=0 for i in a: ans+=i prea....
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
157
// writer: w33z8kqrqk8zzzx33 #include <bits/stdc++.h> using namespace std; #define iter(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, a) iter(i, 0, a) #define rep1(i, a) iter(i, 1, (a) + 1) #define fi first #define se second #define pb push_back #define ll long long #define pii pair<int, int> //#define int ...
// writer: w33z8kqrqk8zzzx33 #include <bits/stdc++.h> using namespace std; #define iter(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, a) iter(i, 0, a) #define rep1(i, a) iter(i, 1, (a) + 1) #define fi first #define se second #define pb push_back #define ll long long #define pii pair<int, int> //#define int ...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
223
// Problem : C - Tsundoku // Contest : AtCoder - AtCoder Beginner Contest 172 // URL : https://atcoder.jp/contests/abc172/tasks/abc172_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #i...
// Problem : C - Tsundoku // Contest : AtCoder - AtCoder Beginner Contest 172 // URL : https://atcoder.jp/contests/abc172/tasks/abc172_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
1,299
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll maxn = 4e5 + 5; const ll maxm = 1e3 + 5; ll n, m, k, l = 1, r = 1, tot = 0, cnt = 0; ll a[maxn], b[maxn]; ll fa[maxn], fb[maxn]; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const ll maxn = 4e5 + 5; const ll maxm = 1e3 + 5; ll n, m, k, l = 1, r = 1, tot = 0, cnt = 0; ll a[maxn], b[maxn]; ll fa[maxn], fb[maxn]; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
289
N, M, K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) ma = 0 mb = 0 i=0 j=0 flag = True while ma + A[i] <= K: ma += A[i] i += 1 if i == len(A): break while mb + B[j] <= K - ma: mb += B[j] j += 1 if j == len(B): flag = False break ans = i +...
N, M, K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) ma = 0 mb = 0 i=0 j=0 flag = True while ma + A[i] <= K: ma += A[i] i += 1 if i == len(A): break while mb + B[j] <= K - ma: mb += B[j] j += 1 if j == len(B): flag = False break ans = i +...
[["-", 0, 656, 0, 52, 15, 679, 12, 666, 667, 47], ["+", 0, 656, 0, 52, 15, 679, 12, 666, 667, 20]]
5
201
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N, M; ll K, A, B; cin >> N >> M >> K; vector<ll> AS(N + 1, 0), BS(M + 1, 0); rep(i, N) { cin >> A; AS[i + 1] = AS[i] + A; } rep(i, M) { cin >> B; BS[i + 1] =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int N, M; ll K, A, B; cin >> N >> M >> K; vector<ll> AS(N + 1, 0), BS(M + 1, 0); rep(i, N) { cin >> A; AS[i + 1] = AS[i] + A; } rep(i, M) { cin >> B; BS[i + 1] =...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
203
from itertools import accumulate from bisect import bisect_left def resolve(): n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) aac = [0] + list(accumulate(a)) bbc = [0] + list(accumulate(b)) ans = 0 for i, aa in enumerate(aac): ...
from itertools import accumulate from bisect import bisect def resolve(): n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) aac = [0] + list(accumulate(a)) bbc = [0] + list(accumulate(b)) ans = 0 for i, aa in enumerate(aac): ...
[["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
151
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0), cin.tie(0); int n, m, k; cin >> n >> m >> k; int a[n], b[m]; for (int i = 0; i < n; i++) { cin >> a[i]; if (i) a[i] += a[i - 1]; } for (int i = 0; i < m; i++) { cin >> b[i]; ...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0), cin.tie(0); int n, m, k; cin >> n >> m >> k; int a[n], b[m]; for (int i = 0; i < n; i++) { cin >> a[i]; if (i) a[i] += a[i - 1]; } for (int i = 0; i < m; i++) { cin >> b[i]; ...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 12, 22]]
1
238
import bisect N,M,K = map(int,input().split()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] bsum = [0] for b in B: bsum.append(bsum[-1]+b) ans = bisect.bisect_left(bsum,K) -1 asum = 0 for n,a in enumerate(A): asum += a if asum > K: break m = bisect.bisect_right(b...
import bisect N,M,K = map(int,input().split()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] bsum = [0] for b in B: bsum.append(bsum[-1]+b) ans = bisect.bisect_right(bsum,K) -1 asum = 0 for n,a in enumerate(A): asum += a if asum > K: break m = bisect.bisect_right(...
[["-", 0, 662, 12, 657, 31, 652, 63, 319, 319, 22], ["+", 0, 662, 12, 657, 31, 652, 63, 319, 319, 22]]
5
140
#include <bits/stdc++.h> using namespace std; int main() { int n, m; unsigned long long k; unsigned long long a[200001], b[200001]; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } for (int i = 1; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } int...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; unsigned long long k; unsigned long long a[200001], b[200001]; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } for (int i = 1; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } int...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 22], ["-", 0, 57, 75, 76, 0, 9, 0, 116, 0, 117], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94]]
1
191
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #define PI acos(-1) #define pb push_back #define all(x) x.begin(), x.end() #define INF 0x3...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #define PI acos(-1) #define pb push_back #define all(x) x.begin(), x.end() #define INF 0x3...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
286
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) #define pb push_back #define all(a) a.begin(), a.end() #define rall(c) (c).rbegin(), (c).rend() #define mp make_pair #define endl '\n' typedef long long ll; typedef pai...
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, m, n) for (int i = (m); i < (n); i++) #define rep(i, n) REP(i, 0, n) #define pb push_back #define all(a) a.begin(), a.end() #define rall(c) (c).rbegin(), (c).rend() #define mp make_pair #define endl '\n' typedef long long ll; typedef pai...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
277
import bisect N, M, K = list(map(int, input().split(" "))) A = list(map(int, input().split(" "))) B = list(map(int, input().split(" "))) asum = [0] for a in A: asum.append(asum[-1] + a) bsum = [0] for b in B: bsum.append(bsum[-1] + b) ans = 0 for i, a in enumerate(asum): btime = K - a if btime > 0: ...
import bisect N, M, K = list(map(int, input().split(" "))) A = list(map(int, input().split(" "))) B = list(map(int, input().split(" "))) asum = [0] for a in A: asum.append(asum[-1] + a) bsum = [0] for b in B: bsum.append(bsum[-1] + b) ans = 0 for i, a in enumerate(asum): btime = K - a if btime < 0: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
162
#include <bits/stdc++.h> using namespace std; #define fi first #define endl "\n" #define se second #define ll long long #define inf 0x3f3f3f3f #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define fi first #define endl "\n" #define se second #define ll long long #define inf 0x3f3f3f3f #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
290
#include <bits/stdc++.h> #define ss second #define ff first #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<ll, ll>; const int oo = 1e9 + 7; const int mod = 1e9 + 7, maxn = 200200; const long double PI = acos(-1); int n, m, k; int main() { ios_base::sync_with_stdio(fa...
#include <bits/stdc++.h> #define ss second #define ff first #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<ll, ll>; const int oo = 1e9 + 7; const int mod = 1e9 + 7, maxn = 200200; const long double PI = acos(-1); ll n, m, k; int main() { ios_base::sync_with_stdio(fal...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0...
1
326
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
363
#include <algorithm> #include <iostream> using namespace std; typedef long long int ll; int main() { ll a[200009], b[200009]; int n, m; cin >> n >> m; int k; cin >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; a[0] = 0; b[0] = 0; for (int i = 1; i <=...
#include <algorithm> #include <iostream> using namespace std; typedef long long int ll; int main() { ll a[200009], b[200009]; int n, m; cin >> n >> m; ll k; cin >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; a[0] = 0; b[0] = 0; for (int i = 1; i <= ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
241
import bisect N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) SA = [0]*(N+1) SB = [0]*(M+1) T = 0 ans = 0 for i in range(N): SA[i+1] = SA[i] + A[i] for i in range(M): SB[i+1] = SB[i] + B[i] for i in range(1, N+1): if SA[i] > K: break ...
import bisect N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) SA = [0]*(N+1) SB = [0]*(M+1) T = 0 ans = 0 for i in range(N): SA[i+1] = SA[i] + A[i] for i in range(M): SB[i+1] = SB[i] + B[i] for i in range(N+1): if SA[i] > K: break ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
182
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll n, m, k, a[200001], b[200001], sa[200001], sb[200001]; bool ok(ll val) { for (int i = 1; i <= n; i++) if (i <= val && val - i <= m) { ll suma = sa[i] + sb[val...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll n, m, k, a[400001], b[400001], sa[400001], sb[400001]; bool ok(ll val) { for (ll i = 0; i <= n; i++) if (i <= val && val - i <= m) { ll suma = sa[i] + sb[val ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
314
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
#include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
[["+", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
435
#include <cstdio> #include <cstring> long long a[200005], b[200005]; long long sum[200005]; int max(int a, int b) { return a > b ? a : b; } int main() { int n, m; long long k; scanf("%d%d%lld", &n, &m, &k); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); for (int i = 1; i <= m; i++) scanf("%lld",...
#include <cstdio> #include <cstring> long long a[200005], b[200005]; long long sum[200005]; int max(int a, int b) { return a > b ? a : b; } int main() { int n, m; long long k; scanf("%d%d%lld", &n, &m, &k); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); for (int i = 1; i <= m; i++) scanf("%lld",...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
256
#include <bits/stdc++.h> using namespace std; #define IO \ { \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define IO \ { \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
250
#include <bits/stdc++.h> using namespace std; long long n, m, k, a[200005], suma[200005], b[200005], sumb[200005], ans; long long bins(int l, int r, long long val) { // cout << l << " " << r << endl; if (l == r) return l; int mid = (l + r + 1) / 2; if (sumb[mid] > val) return bins(l, mid - 1, val); e...
#include <bits/stdc++.h> using namespace std; long long n, m, k, a[200005], suma[200005], b[200005], sumb[200005], ans; long long bins(int l, int r, long long val) { // cout << l << " " << r << endl; if (l == r) return l; int mid = (l + r + 1) / 2; if (sumb[mid] > val) return bins(l, mid - 1, val); e...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
303
#include <bits/stdc++.h> using namespace std; #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define rep(i, n) repl(i, 0, n) #define fi first #define se second #define all(x) (x).begin(), (x).end() #define CST(x) cout << fixed << setprecision(x) using ll = long long; const ll MOD = 1000000007; const int inf = 1e9...
#include <bits/stdc++.h> using namespace std; #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define rep(i, n) repl(i, 0, n) #define fi first #define se second #define all(x) (x).begin(), (x).end() #define CST(x) cout << fixed << setprecision(x) using ll = long long; const ll MOD = 1000000007; const int inf = 1e9...
[["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 17, 33], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 12, 13], ["-", 49, 50, 51, 16, 31, 16, 12, 2, 63, 22], ["+", 49, 50, 51, 16, 31, 16, 12, 2, 63, 22]]
1
319
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
557
N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0]*N for i in range(N): a[i] = A[i]+a[i-1] b = [0]*M for i in range(M): b[i] = B[i]+b[i-1] a = [0]+a b = [0]+b ans = 0 for i in range(N+1): c = a[i] if K-c>=0: j = bisect(b,K-c) a...
from bisect import bisect N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0]*N for i in range(N): a[i] = A[i]+a[i-1] b = [0]*M for i in range(M): b[i] = B[i]+b[i-1] a = [0]+a b = [0]+b ans = 0 for i in range(N+1): c = a[i] if K-c>=0: j...
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
180
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-ffloat-store") // to restrict undesirable precision #pragma GCC optimize( \ "-fno-defer-pop") // to pop argument of functio...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-ffloat-store") // to restrict undesirable precision #pragma GCC optimize( \ "-fno-defer-pop") // to pop argument of functio...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
497
N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) AX = [0];BX = [0] for a in A: AX.append(AX[-1]+a) for b in B: BX.append(BX[-1]+b) ans = 0 j = M for i in range(1,N+1): if AX[i] > K: break while AX[i]+BX[j] > K: j -= 1 ans = ...
N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) AX = [0];BX = [0] for a in A: AX.append(AX[-1]+a) for b in B: BX.append(BX[-1]+b) ans = 0 j = M for i in range(0,N+1): if AX[i] > K: break while AX[i]+BX[j] > K: j -= 1 ans = ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
154
//-------All power is within you,you can do Anything and Everything.---------// #include <bits/stdc++.h> // #pragma GCC optimize("Ofast") using namespace std; //*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*// #define F first #define S second #define pb push_back #define mkp make_pair #d...
//-------All power is within you,you can do Anything and Everything.---------// #include <bits/stdc++.h> // #pragma GCC optimize("Ofast") using namespace std; //*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*// #define F first #define S second #define pb push_back #define mkp make_pair #d...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
375
# coding: utf-8 # Your code here! import sys read = sys.stdin.read readline = sys.stdin.readline n,m,k = map(int,readline().split()) *a, = map(int,readline().split()) *b, = map(int,readline().split()) from itertools import accumulate a = list(accumulate(a)) b = list(accumulate(b)) from bisect import bisect_right a...
# coding: utf-8 # Your code here! import sys read = sys.stdin.read readline = sys.stdin.readline n,m,k = map(int,readline().split()) *a, = map(int,readline().split()) *b, = map(int,readline().split()) from itertools import accumulate a = list(accumulate(a)) b = list(accumulate([0]+b)) from bisect import bisect_righ...
[["+", 0, 652, 3, 4, 0, 657, 31, 634, 0, 70], ["+", 0, 652, 3, 4, 0, 657, 31, 634, 0, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 634, 0, 73], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612]]
5
139
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define ls (o << 1) #define rs (o << 1 | 1) #define pb push_back const double PI = acos(-1.0); const int M = 2e5 + 7; /* int head[M],cnt=1; void init(){cnt=1,memset(head,0,sizeof(head));} struct EDGE{int to,nxt,w;}ee[M*2]; void add(int x,int y,int w){e...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define ls (o << 1) #define rs (o << 1 | 1) #define pb push_back const double PI = acos(-1.0); const int M = 2e5 + 7; /* int head[M],cnt=1; void init(){cnt=1,memset(head,0,sizeof(head));} struct EDGE{int to,nxt,w;}ee[M*2]; void add(int x,int y,int w){e...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
234
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define watch(x) cout << (#x) << "=" << (x) << '\n' #define mset(d, val) memset(d, val, sizeof(d)) #define setp(x) cout << fixed << setprecision(x) #define forn(i, a, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define watch(x) cout << (#x) << "=" << (x) << '\n' #define mset(d, val) memset(d, val, sizeof(d)) #define setp(x) cout << fixed << setprecision(x) #define forn(i, a, ...
[["-", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
509
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define DUMP(x) cout << #x << " = " << (x) << endl; #define FOR(i, m, n) for (ll i = m; i < n; i++) #define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) #define FO...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define DUMP(x) cout << #x << " = " << (x) << endl; #define FOR(i, m, n) for (ll i = m; i < n; i++) #define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) #define FO...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
283
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> using namespace std; /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ #define pb push_back #define rep(i, a, b) for (int i = a; i <= b; i++) #define ll l...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> using namespace std; /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ #define pb push_back #define rep(i, a, b) for (int i = a; i <= b; i++) #define ll l...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 9, 0, 43, 49...
1
268
#include <bits/stdc++.h> using namespace std; #define int long long int #define sp(x) setprecision(x) #define bp(x) __builtin_popcount(x) #define ld long double #define f(i, j, n) for (int i = j; i <= n; i++) #define r(i, n, j) for (int i = n; i >= j; i--) #define all(container) container.begin(), container.end() #def...
#include <bits/stdc++.h> using namespace std; #define int long long int #define sp(x) setprecision(x) #define bp(x) __builtin_popcount(x) #define ld long double #define f(i, j, n) for (int i = j; i <= n; i++) #define r(i, n, j) for (int i = n; i >= j; i--) #define all(container) container.begin(), container.end() #def...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
394
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; const int INF = 1e9; const ll MOD = 1e9 + 7; const ll LINF = 1e18; templat...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) using namespace std; typedef long long ll; const int INF = 1e9; const ll MOD = 1e9 + 7; const ll LINF = 1e18; templat...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
561
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <chrono> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <time.h> #include <vector> using namespace std; #define rep(i, n) for (...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cassert> #include <chrono> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <time.h> #include <vector> using namespace std; #define rep(i, n) for (...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 146], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 147]]
1
1,227
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> P1; typedef pair<P, P> P2; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pi> vpi; typedef vector<vi> vvi; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #de...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> P1; typedef pair<P, P> P2; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pi> vpi; typedef vector<vi> vvi; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #de...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
1,668
#include <bits/stdc++.h> using namespace std; #define reps(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) reps(i, 0, n) #define Rreps(i, n, e) for (int i = n - 1; i >= e; --i) #define Rrep(i, n) Rreps(i, n, 0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vec...
#include <bits/stdc++.h> using namespace std; #define reps(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) reps(i, 0, n) #define Rreps(i, n, e) for (int i = n - 1; i >= e; --i) #define Rrep(i, n) Rreps(i, n, 0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vec...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
1,088
import sys input = sys.stdin.buffer.readline import numpy as np D = int(input()) c = np.array(input().split(), dtype=np.int32) s = np.array([input().split() for _ in range(D)], dtype=np.int32) last = np.zeros(26, dtype=np.int32) ans = [] point = 0 for i in range(D): down = (i+1-last)*c loss = down * 3 + s[i,...
import sys input = sys.stdin.buffer.readline import numpy as np D = int(input()) c = np.array(input().split(), dtype=np.int32) s = np.array([input().split() for _ in range(D)], dtype=np.int32) last = np.zeros(26, dtype=np.int32) ans = [] point = 0 for i in range(D): down = (i+1-last)*c loss = down * 3 + s[i,...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
181
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const ll mod = 1000000007; const ll INF = 1001001001; const ll LINF = 1001001001001001001; void prvec(vector<bool> vec) { ll n = vec.size(); rep(i, n) c...
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const ll mod = 1000000007; const ll INF = 1001001001; const ll LINF = 1001001001001001001; void prvec(vector<bool> vec) { ll n = vec.size(); rep(i, n) c...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
1,143
from random import randint import sys input = sys.stdin.readline def calc_score(D, C, S, T): """ 開催日程Tを受け取ってそこまでのスコアを返す """ contest_last_opened = [0]*26 # コンテストiを前回開催した日 score = 0 for d, t in enumerate(T, start=1): get_score = S[d-1][t-1] score += get_score contest_las...
from random import randint import sys input = sys.stdin.readline def calc_score(D, C, S, T): """ 開催日程Tを受け取ってそこまでのスコアを返す """ contest_last_opened = [0]*26 # コンテストiを前回開催した日 score = 0 for d, t in enumerate(T, start=1): get_score = S[d-1][t-1] score += get_score contest_las...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
278
import sys import numpy as np from operator import mul read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines d = int(readline()) c = list(map(int, readline().split())) s = [] for _ in range(d): add = list(map(int, readline().split())) s.append(add) #t = [0] *...
import sys import numpy as np from operator import mul read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines d = int(readline()) c = list(map(int, readline().split())) s = [] for _ in range(d): add = list(map(int, readline().split())) s.append(add) #t = [0] *...
[["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22]]
5
159
#include <stdio.h> int lday[26] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, dp[365], day[26][365] = {}, dayc[26] = {}; // day コンテストが実施された日 dayc dayのインデックス int c[26], s[365][26]; int calc(int con, int dd) { int...
#include <stdio.h> int lday[26] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, dp[365], day[26][365] = {}, dayc[26] = {}; // day コンテストが実施された日 dayc dayのインデックス int c[26], s[365][26]; int calc(int con, int dd) { int...
[["+", 8, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 8, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
430
def scoring(d, t): arr = [l for l in last] arr[t] = d return S[d][t] - sum((d - l) * c for l, c in zip(arr, C)) D = int(input()) C = list(map(int, input().split())) S = [] for _ in range(D): s = list(map(int, input().split())) S.append(s) last = [-1] * 26 ans = [] for i in range(D): res = -10 *...
def scoring(d, t): arr = [l for l in last] arr[t] = d return S[d][t] - sum((d - l) * c for l, c in zip(arr, C)) D = int(input()) C = list(map(int, input().split())) S = [] for _ in range(D): s = list(map(int, input().split())) S.append(s) last = [-1] * 26 ans = [] for i in range(D): res = -10 *...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
193
#include <bits/stdc++.h> #include <queue> using namespace std; int main() { int D; cin >> D; vector<int> les(26, 0); array<int, 26> c; for (int i = 0; i < 26; i++) cin >> c.at(i); for (int i = 0; i < D; i++) { array<int, 26> s; for (int j = 0; j < 26; j++) { cin >> s.at(j); } pair<...
#include <bits/stdc++.h> #include <queue> using namespace std; int main() { int D; cin >> D; vector<int> les(26, 0); array<int, 26> c; for (int i = 0; i < 26; i++) cin >> c.at(i); for (int i = 0; i < D; i++) { array<int, 26> s; for (int j = 0; j < 26; j++) { cin >> s.at(j); } pair<...
[["-", 0, 16, 31, 16, 12, 16, 31, 118, 28, 22], ["-", 0, 16, 31, 16, 12, 16, 31, 118, 17, 131], ["-", 0, 16, 31, 16, 12, 16, 31, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
284
#include <iostream> #include <vector> using namespace std; using ll = long long; int d; vector<vector<int>> s(365, vector<int>(26)); vector<int> c(26); ll calc(vector<int> t) { ll score = 0; vector<int> last(26); for (int i = 0; i < (int)t.size(); i++) { last[t[i]] = i; for (int j = 0; j < 26; j++) ...
#include <iostream> #include <vector> using namespace std; using ll = long long; int d; vector<vector<int>> s(365, vector<int>(26)); vector<int> c(26); ll calc(vector<int> t) { ll score = 0; vector<int> last(26); for (int i = 0; i < (int)t.size(); i++) { last[t[i]] = i; for (int j = 0; j < 26; j++) ...
[["+", 8, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 8, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
342
import random d = int(input()) dd = d * (d + 1) // 2 *C, = map(int, input().split()) S = [list(map(int, input().split())) for i in range(d)] T = [random.choice(range(26)) for i in range(d)] score = 0 for _ in range(10**5): p = random.choice(range(d)) q = random.choice(range(26)) memo = T[p] T[p] = q ...
import random d = int(input()) dd = d * (d + 1) // 2 *C, = map(int, input().split()) S = [list(map(int, input().split())) for i in range(d)] T = [random.choice(range(26)) for i in range(d)] score = 0 for _ in range(10**5): p = random.choice(range(d)) q = random.choice(range(26)) memo = T[p] T[p] = q ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
260
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int ALP_NUM = 26; int main() { int d; cin >> d; vector<int> C(ALP_NUM); rep(i, ALP_NUM) cin >> C[i]; vector<vector<int>> S(d, vector<int>(ALP_NUM)); rep(i, d)...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int ALP_NUM = 26; int main() { int d; cin >> d; vector<int> C(ALP_NUM); rep(i, ALP_NUM) cin >> C[i]; vector<vector<int>> S(d, vector<int>(ALP_NUM)); rep(i, d)...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
566
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> using namespace std; #define INF 1e9 static const int seed = 6; static const int D = 365; static const int ntype = 26; static int ans[D + 1]; static int max_score = -INF; static int t = 1e4; class Contest { public: Contest() { last = 0; } ...
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> using namespace std; #define INF 1e9 static const int seed = 6; static const int D = 365; static const int ntype = 26; static int ans[D + 1]; static int max_score = -INF; static int t = 1e4; class Contest { public: Contest() { last = 0; } ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
633
#include <bits/stdc++.h> using namespace std; int main() { int D, i, j, sum; scanf("%d", &D); pair<int, vector<int>> ans; pair<int, int> k; int c[26], l[26] = {}, up[26], down[26]; for (i = 0; i < 26; i++) scanf("%d", &c[i]); for (i = 0; i < D; i++) { for (j = 0; j < 26; j++) { scanf("%d", &...
#include <bits/stdc++.h> using namespace std; int main() { int D, i, j, sum; scanf("%d", &D); pair<int, vector<int>> ans; pair<int, int> k; int c[26], l[26] = {}, up[26], down[26]; for (i = 0; i < 26; i++) scanf("%d", &c[i]); for (i = 0; i < D; i++) { for (j = 0; j < 26; j++) { scanf("%d", &...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
380
import numpy as np D = int(input()) c = np.array( list(map(int, input().split())) ) # s = [[] for i in range(D)] for i in range(D): s[i] = np.array( list(map(int, input().split())) ) # v = 0 cc = np.array( [0]*26 ) last = np.array( [-1]*26 ) for d in range(D): cc += c av = s[d] - sum( cc ) + cc av2 = av + cc*...
import numpy as np D = int(input()) c = np.array( list(map(int, input().split())) ) # s = [[] for i in range(D)] for i in range(D): s[i] = np.array( list(map(int, input().split())) ) # v = 0 cc = np.array( [0]*26 ) last = np.array( [-1]*26 ) for d in range(D): cc += c av = s[d] - sum( cc ) + cc av2 = av + cc*...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
198
D = gets.to_i C,*S = (0..D).map{gets.split.map &:to_i} L,M,N = [-1]*27,2,10 1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z| I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end } } def calc(d,n) s,x = S[d],0 n = D-d if n > D-d t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] } i = (0..25).max_by...
D = gets.to_i C,*S = (0..D).map{gets.split.map &:to_i} L,M,N = [-1]*27,2,10 1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z| I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end } } def calc(d,n) s,x = S[d],0 n = D-d if n > D-d t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] } i = (0..25).max_by...
[["+", 486, 516, 0, 742, 0, 738, 31, 739, 0, 24], ["-", 486, 516, 0, 742, 0, 738, 31, 738, 17, 85], ["-", 486, 516, 0, 742, 0, 738, 31, 738, 12, 612], ["+", 486, 516, 0, 742, 0, 738, 31, 739, 0, 25], ["+", 75, 652, 486, 516, 0, 742, 0, 738, 17, 85], ["+", 75, 652, 486, 516, 0, 742, 0, 738, 12, 612]]
4
324
F =->{_1.split.map &:to_i} D = gets.to_i C,*S = (0..D).map{F[gets]} d,*L = [D]*27 A = [] until 0 > d-=1 s = S[d] i,m = -1,-(1<<60) 26.times {|j| n = s[j] - C[j]*(L[j]-d) (i=j;m=n) if m<n } L[i] = d A << i end A.reverse_each {p _1}
F =->{_1.split.map &:to_i} D = gets.to_i C,*S = (0..D).map{F[gets]} d,*L = [D]*27 A = [] until 0 > d-=1 s = S[d] i,m = -1, -(1<<60) 26.times {|j| n = s[j] - C[j]*(L[j]-d) (i=j;m=n) if m<n } L[i] = d A << i end A.reverse_each {p _1+1}
[["+", 8, 734, 0, 652, 3, 4, 0, 738, 17, 72], ["+", 8, 734, 0, 652, 3, 4, 0, 738, 12, 612]]
4
132
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) #define pb push_back #define eb emplace_back using ll = long long; using P = pair<int, int>; using LP = pair<ll, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const ll MO...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
323
D = gets.to_i C = gets.chomp.split.map(&:to_i) s = D.times.map{gets.split.map(&:to_i)} c = Array.new(26, 0) t = [] (0..D-1).each do |i| ans = 0 boder = s[i][0]+c[0] (0..25).each do |l| c[l] += C[l] end (1..25).each do |e| if s[i][e]+c[e] >= boder ans = e boder = s[i][e]+c[e] end end c[...
D = gets.to_i C = gets.chomp.split.map(&:to_i) s = D.times.map{gets.split.map(&:to_i)} c = Array.new(26, 0) t = [] (0..D-1).each do |i| ans = 0 boder = s[i][0]+c[0] (0..25).each do |l| c[l] += C[l] end (1..25).each do |e| if s[i][e]+c[e] >= boder ans = e boder = s[i][e]+c[e] end end c[...
[["-", 0, 652, 196, 737, 8, 736, 0, 738, 31, 22], ["-", 0, 652, 196, 737, 8, 736, 0, 738, 17, 151], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]]
4
161
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,359
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,313
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; constexpr unsigned long long int CYCLES_PER_SEC = 2800000000; constexpr double...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,256
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define INF 1e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef unsigned long long ll; int d = 365; int types = 26; vector<int> c(type...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define INF 1e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef unsigned long long ll; int d = 365; int types = 26; vector<int> c(type...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
534
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define INF 1e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef unsigned long long ll; int d = 365; int types = 26; vector<int> c(type...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (ll i = m; i < n; i++) #define INF 1e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef unsigned long long ll; int d = 365; int types = 26; vector<int> c(type...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
548
import sys import math from collections import deque sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, num): return [[int(num)] * w for _ in...
import sys import math from collections import deque sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, num): return [[int(num)] * w for _ in...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
273
/*/ Author: kal013 /*/ /*/ Author: kal013 /*/ // #pragma GCC optimize ("O3") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_o...
/*/ Author: kal013 /*/ /*/ Author: kal013 /*/ // #pragma GCC optimize ("O3") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_o...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
2,011
#include <bits/stdc++.h> using ll = long long; using namespace std; const int INFint = 1e9 + 1; const ll INFll = (ll)1e18 + 1; ll MOD = 1e9 + 7; int main() { int D; cin >> D; vector<int> c(26 + 1); for (int i(1); i < 27; i++) { cin >> c[i]; } vector<vector<int>> s(D + 1, vector<int>(26 + 1)); for (i...
#include <bits/stdc++.h> using ll = long long; using namespace std; const int INFint = 1e9 + 1; const ll INFll = (ll)1e18 + 1; ll MOD = 1e9 + 7; int main() { int D; cin >> D; vector<int> c(26 + 1); for (int i(1); i < 27; i++) { cin >> c[i]; } vector<vector<int>> s(D + 1, vector<int>(26 + 1)); for (i...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 12, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 12, 23, 0, 16, 12, 69, 341, 342, 0, 22]]
1
389
#include <bits/stdc++.h> #define endl "\n" using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define fi first #define se second ...
#include <bits/stdc++.h> //#define endl "\n" using namespace std; #define ll long long #define ld long double #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repo(i, n) for (int i = 1; i < (int)(n); i++) #define pb push_back #define mp make_pair #define np next_permutation #define fi first #define se secon...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22]]
1
449
# coding: utf-8 # Your code here! import numpy as np d= int(input()) C = list(map(int,input().split())) CB = [0 for i in range(len(C))] c = sum(C) total = 0 #print(c,C,CB) L = [] for i in range(d): L.append(list(map(int,input().split()))) #print(L) #print(T) def cnt(CB,t): for i in range(len(CB)): ...
# coding: utf-8 # Your code here! import numpy as np d= int(input()) C = list(map(int,input().split())) CB = [0 for i in range(len(C))] c = sum(C) total = 0 #print(c,C,CB) L = [] for i in range(d): L.append(list(map(int,input().split()))) #print(L) #print(T) def cnt(CB,t): for i in range(len(CB)): ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
212
def get_score(day, contest, prev_list, loss_list, satisfied_matrix): plus = satisfied_matrix[day][contest] minus = 0 for type, prev in enumerate(prev_list): if type == contest: continue spend = day - prev minus += loss_list[type] * spend return plus - minus days =...
def get_score(day, contest, prev_list, loss_list, satisfied_matrix): plus = satisfied_matrix[day][contest] minus = 0 for type, prev in enumerate(prev_list): if type == contest: continue spend = day - prev minus += loss_list[type] * spend return plus - minus days ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
192
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; #define N 26 #define MAX_T 1.9 const int INF = 1 << 30; const double mean = 0.0; const double stddev = 1.0; int c[N]; int s[365][N]; int last[N]; std::chrono::time_point<std::chrono::steady_clock> start, endt; random_device rd; mt19937 generat...
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; #define N 26 #define MAX_T 1.9 const int INF = 1 << 30; const double mean = 0.0; const double stddev = 1.0; int c[N]; int s[365][N]; int last[N]; std::chrono::time_point<std::chrono::steady_clock> start, endt; random_device rd; mt19937 generat...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 146]]
1
1,019
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
561
#include <bits/stdc++.h> #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimization("Ofast") #pragma GCC optimization("unroll-loops") using namespace std; int D; int c[27], s[400][27]; int L[27]; int last[27]; long long ANS = 0; long long ans = 0; int T[27]; long long test() { ...
#include <bits/stdc++.h> #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimization("Ofast") #pragma GCC optimization("unroll-loops") using namespace std; int D; int c[27], s[400][27]; int L[27]; int last[27]; long long ANS = 0; long long ans = 0; int T[400]; long long test() { ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
774
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <set> #include <vector> using namespace std; typedef long long ll; typedef long double ldb; const int MAXM = 4e2 + 5; const int MAXN = 26 + 5; const int MAXT = 1e7 + 5; const int inf = 0x3f3f3f3f; const ll linf = 0x3f...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <set> #include <vector> using namespace std; typedef long long ll; typedef long double ldb; const int MAXM = 4e2 + 5; const int MAXN = 26 + 5; const int MAXT = 2e7 + 5; const int inf = 0x3f3f3f3f; const ll linf = 0x3f...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 8, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 7, 8, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 7, 8, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 7, 8, 1, 0, 11, 12, 69, 28, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9,...
1
986
#include <bits/stdc++.h> using namespace std; void solve(int D, vector<int> c, vector<vector<int>> s) { vector<int> last(26, -1); int score = 0; for (int d = 0; d < D; d++) { int max_score_d = -1e9, max_td = -1; for (int td = 0; td < 26; td++) { int score_d = score; score_d += s.at(d).at(td);...
#include <bits/stdc++.h> using namespace std; void solve(int D, vector<int> c, vector<vector<int>> s) { vector<int> last(26, -1); int score = 0; for (int d = 0; d < D; d++) { int max_score_d = -1e9, max_td = -1; for (int td = 0; td < 26; td++) { int score_d = score; score_d += s.at(d).at(td);...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
315
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(con...
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(con...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
466
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pp = pair<int, pair<int, int>>; #define MAX 200003 #define MOD 1000000007 #define INF 1000000000000000000 int D; vector<ll> c(26); vector<vector<ll>> s; ll score(vector<int> t) { vector<ll> last(26, 0); ll...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pp = pair<int, pair<int, int>>; #define MAX 200003 #define MOD 1000000007 #define INF 1000000000000000000 int D; vector<ll> c(26); vector<vector<ll>> s; ll score(vector<int> t) { vector<ll> last(26, 0); ll...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
432
#include <climits> #include <cstdio> #include <iostream> #include <vector> using namespace std; vector<int> cs; vector<vector<int>> sm; int total_satisfaction(vector<int> &ts, int d) { vector<int> ls; for (int i = 0; i < 26; i++) ls.push_back(0); int s = 0; for (int i = 0; i < d; i++) { int t = ts[i]...
#include <climits> #include <cstdio> #include <iostream> #include <vector> using namespace std; vector<int> cs; vector<vector<int>> sm; int total_satisfaction(vector<int> &ts, int d) { vector<int> ls; for (int i = 0; i < 26; i++) ls.push_back(0); int s = 0; for (int i = 0; i < d; i++) { int t = ts[i]...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
372
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
[["+", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46]]
1
468
#include "bits/stdc++.h" #define rep(i, N) for (int i = 0; i < N; i++) typedef long long ll; const int mod = 1e9 + 7; using namespace std; int main(void) { int D; cin >> D; vector<int> c(26, 0); rep(i, 26) cin >> c[i]; vector<vector<int>> s(D, vector<int>(26, 0)); rep(i, D) rep(j, 26) cin >> s[i][j]; ...
#include "bits/stdc++.h" #define rep(i, N) for (int i = 0; i < N; i++) typedef long long ll; const int mod = 1e9 + 7; using namespace std; int main(void) { int D; cin >> D; vector<int> c(26, 0); rep(i, 26) cin >> c[i]; vector<vector<int>> s(D, vector<int>(26, 0)); rep(i, D) rep(j, 26) cin >> s[i][j]; ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
167
def calc_score(sch): d=[0]*26 score=0 for i in range(dur): j=sch[i]-1 s=S[i] score+=s[j]+c[j]*(i+1-d[j])+sum([-c[k]*(i+1-d[k]) for k in range(26)]) d[j]=i+1 return score def greedy(dur,c,S,r): sch=[] d=[0]*26 for i in range(dur): t=0 s=S[i] ...
def calc_score(sch): d=[0]*26 score=0 for i in range(dur): j=sch[i]-1 s=S[i] score+=s[j]+c[j]*(i+1-d[j])+sum([-c[k]*(i+1-d[k]) for k in range(26)]) d[j]=i+1 return score def greedy(dur,c,S,r): sch=[] d=[0]*26 for i in range(dur): t=0 s=S[i] ...
[["+", 0, 1, 0, 662, 12, 664, 28, 652, 63, 22], ["+", 0, 662, 12, 664, 28, 652, 3, 4, 0, 24], ["+", 12, 664, 28, 652, 3, 4, 0, 557, 0, 654], ["+", 12, 664, 28, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 662, 12, 664, 28, 652, 3, 4, 0, 25]]
5
371
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPR(i, n) for (int(i) = (n); (i) >= 0; --(i)) #define FOR(i, n, m) for (int(i) = (n); (i) < (m); ++(i)) // constexpr int INF = 1e9; constexpr ll INF = 1LL << 61; constexpr ll mod = 1e9 + 7...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPR(i, n) for (int(i) = (n); (i) >= 0; --(i)) #define FOR(i, n, m) for (int(i) = (n); (i) < (m); ++(i)) // constexpr int INF = 1e9; constexpr ll INF = 1LL << 61; constexpr ll mod = 1e9 + 7...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
540