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
k = int(input()) x = 7 e = 10 for i in range(10000000): # print(x) if x == 0: print(i + 1) exit() x = (x * e + 7) % k print("-1")
k = int(input()) x = 7 e = 10 for i in range(10000000): # print(x) if x % k == 0: print(i + 1) exit() x = (x * e + 7) % k print("-1")
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
54
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll LLINF{1001002003004005006}; // ll = 9*LLINF constexpr int INTINF{1000000000}; // int = 2*INTINF #define rep(i, n)...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; using ull = unsigned long long; constexpr ll LLINF{1001002003004005006}; // ll = 9*LLINF constexpr int INTINF{1000000000}; // int = 2*INTINF #define rep(i, n)...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
323
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define full(a) a.begin(), a.end() #define rfull(a) a.rbegin(), a.rend() using namespace std; const double pi = acos(-1.0); const double pii = 2 * pi; const double eps = 1e-6; const long long MOD = 1e9 + 7; void solve(...
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define full(a) a.begin(), a.end() #define rfull(a) a.rbegin(), a.rend() using namespace std; const double pi = acos(-1.0); const double pii = 2 * pi; const double eps = 1e-6; const long long MOD = 1e9 + 7; void solve(...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
231
#include <stdio.h> int main() { long n, k, a; scanf("%ld", &k); a = 7; for (n = 1; a % k > 0 && n < k; n++) a = (a * 10 + 7) % k; if (n < k) printf("%ld\n", n); else puts("-1"); return 0; }
#include <stdio.h> int main() { long n, k, a; scanf("%ld", &k); a = 7; for (n = 1; a % k > 0 && n <= k; n++) a = (a * 10 + 7) % k; if (n <= k) printf("%ld\n", n); else puts("-1"); return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
87
#include <bits/stdc++.h> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; if (n % 2 == 0) { cout << "-1" << endl; return 0; } ll count = 1, num ...
#include <bits/stdc++.h> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; if (n % 2 == 0) { cout << "-1" << endl; return 0; } ll count = 1, num ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
126
K = int(input()) remainder = 0 for i in range(K): remainder += 7*(pow(10,i,K))%K remainder %= K # print(i,remainder) if remainder == 0: print(i) break else: print(-1)
K = int(input()) remainder = 0 for i in range(K): remainder += 7*(pow(10,i,K))%K remainder %= K # print(i,remainder) if remainder == 0: print(i+1) break else: print(-1)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
56
/* Author:zeke pass System Test! GET AC!! */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include...
/* Author:zeke pass System Test! GET AC!! */ #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
381
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { ll k; cin >> k; ll a = 1; map<ll, ll> m; ll cnt = 1; while (a % k != 0 && m[a % k] != 1) { m[a % k] = 1; a = (a * 10 + 1) % k; cnt++; // cout<<a%k<<endl; } if (a % k == 0) { cout << cnt << endl; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { ll k; cin >> k; ll a = 7; map<ll, ll> m; ll cnt = 1; while (a % k != 0 && m[a % k] != 1) { m[a % k] = 1; a = (a * 10 + 7) % k; cnt++; // cout<<a%k<<endl; } if (a % k == 0) { cout << cnt << endl; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
133
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pp pair<pair<ll, ll>, pair<ll, ll>> #define pll pair<ll, ll> #define pdd pair<double, double> #define vii vector<int> #define vll vector<ll> #define mat vector<vector<ll>> #define lb lower_bound #define ub up...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pp pair<pair<ll, ll>, pair<ll, ll>> #define pll pair<ll, ll> #define pdd pair<double, double> #define vii vector<int> #define vll vector<ll> #define mat vector<vector<ll>> #define lb lower_bound #define ub up...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
395
def main(): K = int(input()) cnt = 1 now_mod10 = 1 mod10 = 1 while cnt < K: md = 7 * now_mod10 if md % K == 0: return cnt mod10 = (mod10 * 10) % K now_mod10 = (now_mod10 + mod10) % K cnt += 1 return -1 if __name__ == '__main__': print(main...
def main(): K = int(input()) cnt = 1 now_mod10 = 1 mod10 = 1 while cnt <= K: md = 7 * now_mod10 if md % K == 0: return cnt mod10 = (mod10 * 10) % K now_mod10 = (now_mod10 + mod10) % K cnt += 1 return -1 if __name__ == '__main__': print(mai...
[["-", 0, 14, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 14, 8, 196, 0, 52, 15, 666, 667, 19]]
5
78
#include <bits/stdc++.h> #define rep(i, n) for (long long int i = 0; i < n; i++) #define _rep(i, m, n) for (long long int i = m; i < n; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; ll gcd(ll A, ll ...
#include <bits/stdc++.h> #define rep(i, n) for (long long int i = 0; i < n; i++) #define _rep(i, m, n) for (long long int i = m; i < n; i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; ll gcd(ll A, ll ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
234
#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 = 1; int K; cin >> K; if (K % 2 == 0) cout << -1 << endl; else { vector<int> L(K, 0); int m = 7 % K; int n = m; L[m] = 1; while (n != 0) ...
#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 = 1; int K; cin >> K; if (K % 2 == 0) cout << -1 << endl; else { vector<int> L(K, 0); int m = 7 % K; int n = m; L[n] = 1; while (n != 0) ...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
150
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
321
# ---------------------------iye ha aam zindegi--------------------------------------------- import math import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys mod = 10 ** 9 + 7 mod1 = 998244353 # ------------------------------warmup------------------------...
# ---------------------------iye ha aam zindegi--------------------------------------------- import math import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys mod = 10 ** 9 + 7 mod1 = 998244353 # ------------------------------warmup------------------------...
[["-", 12, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 12, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
3,495
k = int(input()) x = 7 for i in range(10**6+10): if x == 0: print(i+1) break x = (10*x+7) % k else: print(-1)
k = int(input()) x = 7 % k for i in range(10**6+10): if x == 0: print(i+1) break x = (10*x+7) % k else: print(-1)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
53
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "trace.h" #else #define trace(args...) #endif using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; #define mp make_pair #define ub upper_bound #define lb lower_bound #define fi first #define se second #defi...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "trace.h" #else #define trace(args...) #endif using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; #define mp make_pair #define ub upper_bound #define lb lower_bound #define fi first #define se second #defi...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
236
from collections import defaultdict import sys mod = int(input()) d = defaultdict(int) s = 7 c = 1 while(True): if s == 0: break if s in d: print(-1) sys.exit() d[s] = 1 s = (s*10 + 7) % mod c += 1 print(c)
from collections import defaultdict import sys mod = int(input()) d = defaultdict(int) s = 7 c = 1 s %= mod while(True): if s == 0: break if s in d: print(-1) sys.exit() d[s] = 1 s = (s*10 + 7) % mod c += 1 print(c)
[["+", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 132], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 12, 22]]
5
76
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define maxn 1000010 const int MOD = 1000000007; int pw[maxn + 10]; void solve() { int k; cin >> k; pw[0] = 1; pw[0] %= k; for (int i = 1; i <= maxn; i++) pw[i] = (pw[i - 1] * 10) % k; int cur = 0; for (int d = ...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define maxn 1000010 const int MOD = 1000000007; int pw[maxn + 10]; void solve() { int k; cin >> k; pw[0] = 1; pw[0] %= k; for (int i = 1; i <= maxn; i++) pw[i] = (pw[i - 1] * 10) % k; int cur = 0; for (int d = ...
[["+", 12, 23, 0, 16, 12, 16, 31, 16, 17, 48], ["+", 12, 23, 0, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 11, 12, 23, 0, 16, 12, 16, 17, 109], ["+", 0, 11, 12, 23, 0, 16, 12, 16, 12, 22]]
1
186
// g++ t.cpp -o t && t < p.txt // d>p.txt&&t<p.txt&&t2<p.txt #include <algorithm> // みんな大好きソートと二分探索 #include <ctime> #include <functional> // 関数を変数に入れる子 #include <iostream> // プログラムの耳と口 #include <map> // setの妹 これまた優秀 #include <queue> // きゅーちゃん、だいすき #include <random> // 乱択さん #include <set> // 値...
// g++ t.cpp -o t && t < p.txt // d>p.txt&&t<p.txt&&t2<p.txt #include <algorithm> // みんな大好きソートと二分探索 #include <ctime> #include <functional> // 関数を変数に入れる子 #include <iostream> // プログラムの耳と口 #include <map> // setの妹 これまた優秀 #include <queue> // きゅーちゃん、だいすき #include <random> // 乱択さん #include <set> // 値...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47]]
1
567
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["-", 0, 57, 64, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 28, 22]]
1
291
import sys read = sys.stdin.read readlines = sys.stdin.readlines from math import ceil def main(): n, k = map(int, input().split()) a = tuple(map(int, input().split())) def kaisu(long): return(sum([ceil(ae/long) - 1 for ae in a])) def bs_meguru(key): def isOK(index, key): ...
import sys read = sys.stdin.read readlines = sys.stdin.readlines from math import ceil def main(): n, k = map(int, input().split()) a = tuple(map(int, input().split())) def kaisu(long): return(sum([ceil(ae/long) - 1 for ae in a])) def bs_meguru(key): def isOK(index, key): ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
175
def main(): l,r=0,10**9 while r-l>1: m=(l+r)//2 if sum([(i-1)//x for i in a])<=k: r=m; else: l=m; print(r) if __name__=='__main__': n,k=map(int,input().split()) a=list(map(int,input().split())) main()
def main(): l,r=0,10**9 while r-l>1: m=(l+r)//2 if sum([(i-1)//m for i in a])<=k: r=m; else: l=m; print(r) if __name__=='__main__': n,k=map(int,input().split()) a=list(map(int,input().split())) main()
[["-", 0, 652, 3, 4, 0, 658, 8, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 658, 8, 657, 12, 22]]
5
107
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ll long long #define rep(i, n) for (int i = 0; i < int(n); i++) #define vi vector<int> using namespace std; const int INF = 1001001001; const int MOD = 1e9 + 7; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inlin...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ll long long #define rep(i, n) for (int i = 0; i < int(n); i++) #define vi vector<int> using namespace std; const int INF = 1001001001; const int MOD = 1e9 + 7; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inlin...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 31, 13], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 12, 22], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 12, 13]]
1
294
#include <bits/stdc++.h> using namespace std; vector<int> arr; long long cut(int x) { long long ret = 0; for (int i = 0; i < arr.size(); i++) { if (arr[i] > x) { ret += arr[i] / x; if (arr[i] % x == 0) ret--; } } return ret; } int main() { int n, k; cin >> n >> k; arr = vector<...
#include <bits/stdc++.h> using namespace std; vector<int> arr; long long cut(int x) { long long ret = 0; for (int i = 0; i < arr.size(); i++) { if (arr[i] > x) { ret += arr[i] / x; if (arr[i] % x == 0) ret--; } } return ret; } int main() { int n, k; cin >> n >> k; arr = vector<...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
201
from sys import stdin input = stdin.readline import math import heapq def solve(): n, k = map(int, input().split()) a = list(map(int, input().split())) left = 1 right = max(a) def ok(l): s = sum([i // l for i in a]) return s <= k while left < right: mid = (left + rig...
from sys import stdin input = stdin.readline import math import heapq def solve(): n, k = map(int, input().split()) a = list(map(int, input().split())) left = 1 right = max(a) def ok(l): s = sum([(i-1) // l for i in a]) return s <= k while left < right: mid = (left + ...
[["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 24], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 658, 8, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 25]]
5
128
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int, int>; using mp = map<int, int>; const int MOD = 1e9 + 7; const int INF = 1001001001; int main(void) { int n, k; cin >> n >> k; vector<int> a(n); int amax = 0; for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int, int>; using mp = map<int, int>; const int MOD = 1e9 + 7; const int INF = 1001001001; int main(void) { int n, k; cin >> n >> k; vector<int> a(n); int amax = 0; for (int i = 0; i ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
216
/// Bismillahir Rahmanir Rahim // Author: Tanvir Hussain // ICE,NSTU #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; const long long MOD = 1000000007; #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") ...
/// Bismillahir Rahmanir Rahim // Author: Tanvir Hussain // ICE,NSTU #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; const long long MOD = 1000000007; #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
986
import math n, k = map(int, input().split()) a = list(map(int, input().split())) def is_ok(x,a,k): b = 0 for ai in a: b += math.ceil(ai/x) b -= 1 print(x,b) if b <= k: return True def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if ...
import math n, k = map(int, input().split()) a = list(map(int, input().split())) def is_ok(x,a,k): b = 0 for ai in a: b += math.ceil(ai/x) b -= 1 if b <= k: return True def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid,a,k):...
[["-", 0, 14, 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
140
#include <bits/stdc++.h> using namespace std; const int MN = 200012; int n, k; int a[MN]; bool check(int x) { int ctr = k; for (int i = 0; i < n; i++) { int cuts = a[i] / x; if (cuts > ctr) return false; ctr -= cuts; } return true; } int main(void) { ios::sync_with_stdio(false); cin.ti...
#include <bits/stdc++.h> using namespace std; const int MN = 200012; int n, k; int a[MN]; bool check(int x) { int ctr = k; for (int i = 0; i < n; i++) { int cuts = (a[i] - 1) / x; if (cuts > ctr) return false; ctr -= cuts; } return true; } int main(void) { ios::sync_with_stdio(false); ...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25]]
1
206
// #define _GLIBCXX_DEBUG // #pragma GCC optimize("Ofast") #pragma GCC diagnostic ignored "-Wsign-compare" #include <bits/stdc++.h> // #include <atcoder/all> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define reps(i, s, n) for (int i = s; i < (int)(n); ++i) using namespace std; using ll = long long; template ...
// #define _GLIBCXX_DEBUG // #pragma GCC optimize("Ofast") #pragma GCC diagnostic ignored "-Wsign-compare" #include <bits/stdc++.h> // #include <atcoder/all> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define reps(i, s, n) for (int i = s; i < (int)(n); ++i) using namespace std; using ll = long long; template ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
276
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int...
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
177
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(N, K, A): lo = -1 hi = 10**9 while hi - lo > 1: m = (lo + hi) // 2 if sum((a + m - 1) // m - 1 for a in A) <= K: hi = m else: lo = m print(hi) if __name__ == '__main__': input = sys.stdin.readline N, K = ...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(N, K, A): lo = 0 hi = 10**9 while hi - lo > 1: m = (lo + hi) // 2 if sum((a + m - 1) // m - 1 for a in A) <= K: hi = m else: lo = m print(hi) if __name__ == '__main__': input = sys.stdin.readline N, K = m...
[["-", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
126
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; const int maxn = 3e5 + 50; const int inf = 0x3f3f3f3f; const int MOD = 1e9 + 7...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; const int maxn = 3e5 + 50; const int inf = 0x3f3f3f3f; const int MOD = 1e9 + 7...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 146], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 147]]
1
288
// g++ -std=c++11 test.cpp && ./a.out // g++ -std=c++11 bfs.cpp && cat bfs.txt | ./a.out #include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <queue> using namespace std; #define PRINT(A) \ { ...
// g++ -std=c++11 test.cpp && ./a.out // g++ -std=c++11 bfs.cpp && cat bfs.txt | ./a.out #include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <queue> using namespace std; #define PRINT(A) \ { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
262
def is_ok(X): cnt = 0 for a in A: cnt += a//X-1 if cnt <= k: return True else: return False def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok n, k =...
def is_ok(X): cnt = 0 for a in A: cnt += -(-a//X)-1 if cnt <= k: return True else: return False def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok n,...
[["+", 0, 1, 0, 677, 12, 657, 31, 664, 17, 33], ["+", 0, 677, 12, 657, 31, 664, 28, 23, 0, 24], ["+", 31, 664, 28, 23, 0, 657, 31, 664, 17, 33], ["+", 0, 677, 12, 657, 31, 664, 28, 23, 0, 25]]
5
124
def is_ok(X): cnt = 0 for a in A: cnt += a//X if cnt <= k: return True else: return False def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok n, k = m...
def is_ok(X): cnt = 0 for a in A: cnt += (a-1)//X if cnt <= k: return True else: return False def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok n, k...
[["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]]
5
122
#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>; int main() { int N, K; cin >> N >> K; int A[N]; int max = 0; rep(i, N) { cin >> A[i]; max = fmax(max, A[i]); } // binary search int now = max; int up = N...
#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>; int main() { int N, K; cin >> N >> K; int A[N]; int max = 0; rep(i, N) { cin >> A[i]; max = fmax(max, A[i]); } // binary search int now = max; int up = N...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 22]]
1
219
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define...
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
342
#include "list" #include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <unordered_set> #include <vector> using namespace std; using ll = long long; using ull = unsi...
#include "list" #include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <unordered_set> #include <vector> using namespace std; using ll = long long; using ull = unsi...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 52, 15, 339, 51, 16, ...
1
1,105
def possible(x): global k cnt = 0 for i in a: if i % x == 0: cnt += i // x - 1 else: cnt += i // x if cnt <= k: return True return False n, k = map(int, input().split()) a = list(map(int, input().split())) mini = 1 maxi = max(a) while mini <= maxi...
def possible(x): global k cnt = 0 for i in a: if i % x == 0: cnt += i // x - 1 else: cnt += i // x if cnt <= k: return True return False n, k = map(int, input().split()) a = list(map(int, input().split())) mini = 1 maxi = max(a) while mini <= maxi...
[["-", 64, 196, 0, 57, 15, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 57, 15, 652, 3, 4, 0, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
159
#include <bits/stdc++.h> #define ll long long #define str string #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define vc vector<char> #define vvc vector<vc> #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvll vector<vll> #define vvvll vector<vvll...
#include <bits/stdc++.h> #define ll long long #define str string #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define vc vector<char> #define vvc vector<vc> #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvll vector<vll> #define vvvll vector<vvll...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
606
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> P; constexpr int INF = 1e9; constexpr int MOD = 1e9 + 7; int main() { ll n, k; cin >> n >> k; vector<ll...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> P; constexpr int INF = 1e9; constexpr int MOD = 1e9 + 7; int main() { ll n, k; cin >> n >> k; vector<ll...
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
245
N, K=map(int,input().split()) A=list(map(int,input().split())) def judge(ans,K,A): cut=0 for i in range(len(A)): cut+=(A[i]-1)//ans if cut>K: return False else: return True ansp=max(A) ansm=min(A) ans=(ansp+ansm)//2 d=1 while ansp-ansm>d: if judge(ans,K,A): an...
import math N, K=map(int,input().split()) A=list(map(int,input().split())) def judge(ans,K,A): cut=0 for i in range(len(A)): cut+=(A[i]-1)//ans if cut>K: return False else: return True ansp=max(A) ansm=0 ans=(ansp+ansm)//2 d=1 while ansp-ansm>d: if judge(ans,K,A): ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 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, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
142
#include <bits/stdc++.h> #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long...
#include <bits/stdc++.h> #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; using ll = long...
[["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
258
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; const int maxn = 200005; long long a[maxn], N, K; b...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; const int maxn = 200005; long long a[maxn], N, K; b...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
224
N, K = map(int, input().split()) A = list(map(int, input().split())) def isOK(x): cnt = 0 for a in A: cnt += (a + x - 1) // x - 1 return cnt <= K left, right = 1, 10 ** 18 while right - left > 1: mid = (left + right) // 2 if isOK(mid): left = mid else: right = mid print...
N, K = map(int, input().split()) A = list(map(int, input().split())) def isOK(x): cnt = 0 for a in A: cnt += (a + x - 1) // x - 1 return cnt <= K left, right = 0, 10 ** 10 while right - left > 1: mid = (left + right) // 2 if isOK(mid): right = mid else: left = mid print...
[["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["-", 0, 1, 0, 662, 12, 432, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 432, 0, 657, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22]...
5
107
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") #pragma GCC optimize("-Ofast", "-funroll-all-loops", "-ffast-math") //~ #pragma GCC target ("avx2") //~ #pragma GCC //target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <algorithm> #...
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") #pragma GCC optimize("-Ofast", "-funroll-all-loops", "-ffast-math") //~ #pragma GCC target ("avx2") //~ #pragma GCC //target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <algorithm> #...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
767
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; ++i) #define rep(i, n) repl(i, 0, n) #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() using namespace std; using ll = long long; using ld = long double; using P = pair<int, in...
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; ++i) #define rep(i, n) repl(i, 0, n) #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() using namespace std; using ll = long long; using ld = long double; using P = pair<int, in...
[["+", 51, 218, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 51, 218, 8, 9, 0, 14, 8, 9, 0, 46]]
1
248
#include <bits/stdc++.h> using namespace std; using llong = long long int; #define rep(i, n) for (int i = 0; i < n; ++i) #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() const static int MOD = 1000000007; const static in...
#include <bits/stdc++.h> using namespace std; using llong = long long int; #define rep(i, n) for (int i = 0; i < n; ++i) #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() const static int MOD = 1000000007; const static in...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
248
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<int> a(n); for (auto &&i : a) cin >> i; int L = -1, R = *max_element(a.begin(), a.end()); while (R - L > 1) { int M = (L + R) / 2; int cnt = 0; for (auto &&i...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<int> a(n); for (auto &&i : a) cin >> i; int L = 0, R = *max_element(a.begin(), a.end()); while (R - L > 1) { int M = (L + R) / 2; int cnt = 0; for (auto &&i ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
149
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int k, n; cin >> n >> k; vector<int> arr(n); int l = 1, r = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; r = max(r, arr[i]); } while (l != r) { int m = (l + r) / 2; int s = 0; for (int i = 0; i < n;...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int k, n; cin >> n >> k; vector<int> arr(n); int l = 1, r = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; r = max(r, arr[i]); } while (l != r) { int m = (l + r) / 2; int s = 0; for (int i = 0; i < n;...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
151
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
580
#include <stdio.h> int main() { int i, N, K, A[200001], max = 0; scanf("%d %d", &N, &K); for (i = 1; i <= N; i++) { scanf("%d\n", &(A[i])); if (A[i] > max) max = A[i]; } int l = 1, r = max, m, tmp, count; while (l < r) { m = (l + r) / 2; for (i = 1, count = 0; i <= N; i++) { co...
#include <stdio.h> int main() { int i, N, K, A[200001], max = 0; scanf("%d %d", &N, &K); for (i = 1; i <= N; i++) { scanf("%d\n", &(A[i])); if (A[i] > max) max = A[i]; } int l = 1, r = max, m, tmp, count; while (l < r) { m = (l + r) / 2; for (i = 1, count = 0; i <= N; i++) { co...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
0
188
def solve(): N, K = map(int,input().split()) A = list(map(int,input().split())) left = 1 right = 10 ** 9 + 1 while right - left > 1: mid = (right+left) // 2 cnt = 0 for a in A: cnt += (a-1) // mid if cnt <= K: right = mid else...
def solve(): N, K = map(int,input().split()) A = list(map(int,input().split())) left = 0 right = 10 ** 9 while right - left > 1: mid = (right+left) // 2 cnt = 0 for a in A: cnt += (a-1) // mid if cnt <= K: right = mid else: ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
108
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 100000000; #define rep1(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, k, n) for (ll i = k; i < (n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = 100000000; #define rep1(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, k, n) for (ll i = k; i < (n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
266
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> #include <...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> #include <...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
421
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int n, k; vector<int> a; bool ok(int md) { int cnt = 0; for (int i = 0; i < n; i++) { cnt += (a[i] - 1) / md; } return cnt <= k; } int main() { cin >> n >> k; a.resize(n); for (int i = 0; i < n; i++) { cin >> a[i]; } ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int n, k; vector<int> a; bool ok(int md) { int cnt = 0; for (int i = 0; i < n; i++) { cnt += (a[i] - 1) / md; } return cnt <= k; } int main() { cin >> n >> k; a.resize(n); for (int i = 0; i < n; i++) { cin >> a[i]; } ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
190
n, k = [int(i) for i in input().split()] woods = [int(i) for i in input().split()] def k_cut_less_than(k, l, woods): kaisuu = 0 for wood in woods: kaisuu += (wood-1) // l if kaisuu <= k: return False return True # 二分探索 # functionを満たす,search_listの最大の要素を出力 # 【注意点】searchリストの初めの方はfunctio...
n, k = [int(i) for i in input().split()] woods = [int(i) for i in input().split()] def k_cut_less_than(k, l, woods): kaisuu = 0 for wood in woods: kaisuu += (wood-1) // l if kaisuu <= k: return False return True # 二分探索 # functionを満たす,search_listの最大の要素を出力 # 【注意点】searchリストの初めの方はfunctio...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
160
N, K = gets.split.map(&:to_i) A = gets.split.map(&:to_i) s = A.max l, r = 1, s while l < r m = l + (r - l) / 2 mk = A.map{|v| (v / (m + 0.0)).ceil - 1}.sum # pp [l,r,m,mk] if mk > K then l = m + 1 else mk < K r = m - 1 end end puts r
N, K = gets.split.map(&:to_i) A = gets.split.map(&:to_i) s = A.max l, r = 1, s while l <= r m = l + (r - l) / 2 mk = A.map{|v| (v / (m + 0.0)).ceil - 1}.sum # pp [l,r,m,mk] if mk > K then l = m + 1 else r = m - 1 end end puts l
[["-", 36, 36, 0, 493, 0, 89, 15, 738, 17, 18], ["+", 36, 36, 0, 493, 0, 89, 15, 738, 17, 19], ["-", 8, 170, 0, 121, 75, 95, 0, 738, 31, 22], ["-", 8, 170, 0, 121, 75, 95, 0, 738, 17, 18], ["-", 8, 170, 0, 121, 75, 95, 0, 738, 12, 743], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, ...
4
100
//#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int arr[N]; int main() { // freopen("test.in", "r", stdin); // freopen("ac.txt", "w", stdout); int n, k; scanf("%d %d", &n, &k); int s = 1, e = 1; for (int i = 0; i <...
//#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int arr[N]; int main() { // freopen("test.in", "r", stdin); // freopen("ac.txt", "w", stdout); int n, k; scanf("%d %d", &n, &k); int s = 1, e = 1; for (int i = 0; i <...
[["-", 12, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33]]
1
179
import sys import math input = sys.stdin.readline def can(arr, m, K): need = 0 for x in arr: if x > m: need += int(x // m) return need <= K N, K = map(int, input().split()) arr = list(map(int, input().split())) lo = 0 hi = int(1e9) + 1 while (lo < hi): m = int((lo + hi) // 2) if (can(arr, m, K)...
import sys import math input = sys.stdin.readline def can(arr, m, K): need = 0 for x in arr: if x > m: need += int(x // m) return need <= K N, K = map(int, input().split()) arr = list(map(int, input().split())) lo = 1 hi = int(1e9) + 1 while (lo < hi): m = int((lo + hi) // 2) if (can(arr, m, K)...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
135
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする // cmdで g++ test.cpp とするとコンパイルできる //制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい // https://github.com/atcoder/live_library #define ALL(x) x.begin(), x.end() #define get_tp(t, i) get<i>(t) #define len(x) (ll)(x.size()) #...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG // GCC5.4.1で配列の範囲外アクセスをエラーにする // cmdで g++ test.cpp とするとコンパイルできる //制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい // https://github.com/atcoder/live_library #define ALL(x) x.begin(), x.end() #define get_tp(t, i) get<i>(t) #define len(x) (ll)(x.size()) #...
[["+", 12, 16, 31, 74, 51, 2, 3, 4, 0, 25], ["-", 0, 11, 12, 74, 51, 2, 3, 4, 0, 25]]
1
343
N,K = map(int, input().split()) A = list(map(int, input().split())) l,r = 0,max(A) while l<r: m = (l+r)//2 s = sum([a//m+(not a%m==0)-1 for a in A]) if s <= K: r = m else: l = m+1 print(r)
N,K = map(int, input().split()) A = list(map(int, input().split())) l,r = 1,max(A) while l<r: m = (l+r)//2 s = sum([a//m+(not a%m==0)-1 for a in A]) if s <= K: r = m else: l = m+1 print(r)
[["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612]]
5
101
n,k = gets.chomp.split(" ").map(&:to_i) a_arr = gets.chomp.split(" ").map(&:to_i) l = 0 r = a_arr.max # 二分探索 while true do len = (r + l) / 2 break if len tmp_k = 0 a_arr.each do |a| tmp_k += (a / len.to_f).ceil - 1 end if tmp_k <= k r = len else l = len end if r - l <= 1 break e...
n,k = gets.chomp.split(" ").map(&:to_i) a_arr = gets.chomp.split(" ").map(&:to_i) l = 0 r = a_arr.max # 二分探索 while true do len = (r + l) / 2 break if len == 0 tmp_k = 0 a_arr.each do |a| tmp_k += (a / len.to_f).ceil - 1 end if tmp_k <= k r = len else l = len end if r - l <= 1 brea...
[["+", 0, 89, 8, 170, 0, 751, 15, 738, 17, 60], ["+", 0, 89, 8, 170, 0, 751, 15, 738, 12, 612]]
4
111
def main(): n,k = map(int,input().split()) A = list(map(int,input().split())) left = 0 right = max(A) while abs(right-left)>1: cent = (right+left)//2 ct = 0 for a in A: ct+=a//cent if ct <= k: right=cent else: ...
def main(): n,k = map(int,input().split()) A = list(map(int,input().split())) left = 0 right = max(A) while abs(right-left)>1: cent = (right+left)//2 ct = 0 for a in A: ct+=(a-0.1)//cent if ct <= k: right=cent else: ...
[["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 531], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]]
5
99
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T>...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T>...
[["-", 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, 11, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 25]]
1
277
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <unordered_map> #include <vector> #define ll long long bool isPrime(ll n) { if (n % 2 == 0 || n % 3 == 0) return false; if (n <= 1) return false; if (n <...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <unordered_map> #include <vector> #define ll long long bool isPrime(ll n) { if (n % 2 == 0 || n % 3 == 0) return false; if (n <= 1) return false; if (n <...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
386
import math N, K = map(int,input().split()) logs = list(map(int,input().split())) a = 0 b = max(logs) b_memo = set() count=0 flg =0 while b-a < 1: c = (a+b)//2 times = [] for i in logs: times.append(math.floor(i/c)) if sum(times) > K: a = c else: b = c print(b)
import math N, K = map(int,input().split()) logs = list(map(int,input().split())) a = 0 b = max(logs) b_memo = set() count=0 flg =0 while b-a > 1: c = (a+b)//2 times = [] for i in logs: times.append(math.ceil(i/c)-1) if sum(times) > K: a = c else: b = c print(b)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 47], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 3, 4, 0, 657, 31, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
113
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < int(n); i+...
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < int(n); i+...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
315
N, K = map(int, input().split()) X = list(map(int, input().split())) ub = 10 ** 9 + 7 lb = 0 while ub - lb > 1: mid = (ub + lb) // 2 res = 0 for v in X: res += v // mid if res <= K: ub = mid else: lb = mid if K == 0: print(max(X)) else: print(ub)
N, K = map(int, input().split()) X = list(map(int, input().split())) ub = 10 ** 9 + 7 lb = 0 while ub - lb > 1: mid = (ub + lb) // 2 res = 0 for v in X: res += (v - 1) // mid if res <= K: ub = mid else: lb = mid if K == 0: print(max(X)) else: print(ub)
[["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25]]
5
103
import math n, k = map(int, input().split()) a = list(map(int, input().split())) def binary_search(ng=1, ok=max(a)): if ok - ng < 2: return ok mid = (ok + ng) // 2 cnt = 0 for i in a: cnt += math.ceil(i / mid) - 1 if cnt <= k: return binary_search(ng, mid) else: return ...
import math n, k = map(int, input().split()) a = list(map(int, input().split())) def binary_search(ng=0, ok=max(a)): if ok - ng < 2: return ok mid = (ok + ng) // 2 cnt = 0 for i in a: cnt += math.ceil(i / mid) - 1 if cnt <= k: return binary_search(ng, mid) else: return ...
[["-", 0, 656, 0, 14, 54, 54, 0, 696, 51, 612], ["+", 0, 656, 0, 14, 54, 54, 0, 696, 51, 612]]
5
115
n,k = map(int,input().split()) A = list(map(int,input().split())) ng = 0 ok = max(A) def queri(n): count = 0 for i in A: count += -(-i//n) if k>= count: return True else: return False while ok - ng > 1: mid = (ok+ng)//2 if queri(mid) : ok = mid else: ...
n,k = map(int,input().split()) A = list(map(int,input().split())) ng = 0 ok = max(A) def queri(n): count = 0 for i in A: count += -(-i//n)-1 if k>= count: return True else: return False while ok - ng > 1: mid = (ok+ng)//2 if queri(mid) : ok = mid else: ...
[["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612]]
5
110
#include <bits/stdc++.h> using ll = long long; signed main() { int n, K; std::cin >> n >> K; std::vector<int> a(n); for (int i = 0; i < n; i++) std::cin >> a[i]; int low = 0, high = 1e9 + 1; while (high - low > 1) { int mid = (high + low) / 2; int cnt = 0; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using ll = long long; signed main() { int n, K; std::cin >> n >> K; std::vector<int> a(n); for (int i = 0; i < n; i++) std::cin >> a[i]; int low = 0, high = 1e9 + 1; while (high - low > 1) { int mid = (high + low) / 2; int cnt = 0; for (int i = 0; i < n; i++) { ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
148
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null...
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
618
import math N, K = map(int, input().split()) a = list(map(int, input().split())) def cal(x): s = 0 for aa in a: s += math.ceil(aa/x) - 1 if s <= K: return True else: return False l = 1 r = max(a) while (r - l) > 1: mid = (l + r) // 2 if cal(mid): r = mid else: l = ...
import math N, K = map(int, input().split()) a = list(map(int, input().split())) def cal(x): s = 0 for aa in a: s += math.ceil(aa / x) - 1 if s <= K: return True else: return False l = 0 r = max(a) while r - l > 1: mid = (l + r) // 2 if cal(mid): r = mid else: l = ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 52, 15, 666, 0, 23, 0, 24], ["-", 0, 656, 0, 52, 15, 666, 0, 23, 0, 25]]
5
117
import math N, K = map(int, input().split()) a = list(map(int, input().split())) def cal(x): s = 0 for aa in a: s += math.ceil(aa/x) - 1 if s <= K: return True else: return False l = 1 r = max(a) while abs(r - l) > 1: mid = (l + r) // 2 if cal(mid): r = mid else: l...
import math N, K = map(int, input().split()) a = list(map(int, input().split())) def cal(x): s = 0 for aa in a: s += math.ceil(aa / x) - 1 if s <= K: return True else: return False l = 0 r = max(a) while abs(r - l) > 1: mid = (l + r) // 2 if cal(mid): r = mid else: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
118
n,k=list(map(int,input().split())) alst=list(map(int,input().split())) ok=max(alst) ng=0 while abs(ok-ng)>0: cen=(ok+ng)//2 cnt=0 for a in alst: cnt+=(a+cen-1)//cen-1 if cnt<=k: ok=cen else: ng=cen+1 print(ok)
n,k=list(map(int,input().split())) alst=list(map(int,input().split())) ok=max(alst) ng=0 while abs(ok-ng)>1: cen=(ok+ng)//2 cnt=0 for a in alst: cnt+=(a+cen-1)//cen-1 if cnt<=k: ok=cen else: ng=cen print(ok)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 0, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
104
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; cerr << '=' << h << ','; _d...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; cerr << '=' << h << ','; _d...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
725
#include <bits/stdc++.h> using namespace std; using ll = long long; #include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <unordered_map> #inc...
#include <bits/stdc++.h> using namespace std; using ll = long long; #include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <unordered_map> #inc...
[["-", 51, 218, 8, 9, 0, 37, 0, 16, 31, 22], ["+", 51, 218, 8, 9, 0, 37, 0, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22]]
1
1,377
#include <bits/stdc++.h> using namespace std; const int mn = 2e5 + 7; int a[mn], n, k; bool check(int x) { int cnt = 0; for (int i = 1; i <= n; ++i) cnt += a[i] / x; if (cnt <= k) return 1; return 0; } int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); ...
#include <bits/stdc++.h> using namespace std; const int mn = 2e5 + 7; int a[mn], n, k; bool check(int x) { int cnt = 0; for (int i = 1; i <= n; ++i) cnt += (a[i] - 1) / x; if (cnt <= k) return 1; return 0; } int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i])...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
197
from math import ceil def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) def check(Min): kill = 0 for a in A: kill += (ceil(a/Min)-1) return kill <= K l = 1 r = 1000000000 while r-l > 1: mid = (l+r)//2 if chec...
from math import ceil def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) def check(Min): kill = 0 for a in A: kill += (ceil(a/Min)-1) return kill <= K l = 0 r = 1000000000 while r-l > 1: mid = (l+r)//2 if chec...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
122
from math import ceil n, k = map(int, input().split()) logs = list(map(int, input().split())) def is_ok(num): t = 0 for log in logs: if log <= num: continue t += ceil(log / n) - 1 return t <= k ng = 0 ok = 10 ** 9 while ok - ng > 1 : m = (ok + ng) // 2 if is_ok(m): ok = m else: ...
from math import ceil n, k = map(int, input().split()) logs = list(map(int, input().split())) def is_ok(num): t = 0 for log in logs: if log <= num: continue t += ceil(log / num) - 1 return t <= k ng = 0 ok = 10 ** 9 while ok - ng > 1 : m = (ok + ng) // 2 if is_ok(m): ok = m else: ...
[["-", 12, 657, 31, 652, 3, 4, 0, 657, 12, 22], ["+", 12, 657, 31, 652, 3, 4, 0, 657, 12, 22]]
5
116
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int maxa = -1; rep(i, n) { cin >> a[i]; maxa = (maxa, a[i]); } int l = 0, r = maxa; while (l + 1 < r) { int x = (l + r) / 2; auto f = [&](i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int maxa = -1; rep(i, n) { cin >> a[i]; maxa = max(maxa, a[i]); } int l = 0, r = maxa; while (l + 1 < r) { int x = (l + r) / 2; auto f = [&...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
168
import math n,k=map(int,input().split()) a=list(map(int,input().split())) def is_ok(arg): cnt=0 for i in a: cnt+=(i-1)//arg return k>=cnt def binsearch(ng,ok): while abs(ok-ng)>1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok print(binsearch(1,10**9+1))
import math n,k=map(int,input().split()) a=list(map(int,input().split())) def is_ok(arg): cnt=0 for i in a: cnt+=(i-1)//arg return k>=cnt def binsearch(ng,ok): while abs(ok-ng)>1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok print(binsearch(0,10**9+1))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
118
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constex...
[["-", 51, 218, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 51, 218, 8, 9, 0, 43, 49, 50, 51, 13]]
1
283
import math as m def isltK(K,X): ccut=0 for Ai in As: ccut += m.ceil(Ai/X)-1 if ccut <=K: return True else: return False N,K=map(int,input().split()) As=list(map(int,input().split())) l=0 h=max(As) while l < h: mid = (l+h)//2 if isltK(K,mid): h=mid else: ...
import math as m def isltK(K,X): ccut=0 for Ai in As: ccut += m.ceil(Ai/X)-1 if ccut <=K: return True else: return False N,K=map(int,input().split()) As=list(map(int,input().split())) l=1 h=max(As) while l < h: mid = (l+h)//2 if isltK(K,mid): h=mid else: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
121
// Problem : E - Logs // Contest : AtCoder - AtCoder Beginner Contest 174 // URL : https://atcoder.jp/contests/abc174/tasks/abc174_e // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define ll long long #define rep(i, a, n) for (...
// Problem : E - Logs // Contest : AtCoder - AtCoder Beginner Contest 174 // URL : https://atcoder.jp/contests/abc174/tasks/abc174_e // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define ll long long #define rep(i, a, n) for (...
[["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 23, 0, 16, 31, 23, 0, 25]]
1
240
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, k; ll a[200001]; bool check(ll x) { ll mov = 0; for (ll i = 0; i < n; i++) { mov += (a[i] - 1) / x; } if (mov <= k) { return true; } return false; } int main() { cin >> n >> k; for (ll i = 0; i < n; i++) { cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, k; ll a[200001]; bool check(ll x) { ll mov = 0; for (ll i = 0; i < n; i++) { mov += (a[i] - 1) / x; } if (mov <= k) { return true; } return false; } int main() { cin >> n >> k; for (ll i = 0; i < n; i++) { cin >> a[i]; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
187
n, k = map(int, input().split()) a = list(map(int, input().split())) l, r = 1, 10 ** 9 while l < r: m = (l + r) // 2 if sum(map(lambda v: (v - 1) // m, a)) > k: l = m + 1 else: r = m print(l, r)
n, k = map(int, input().split()) a = list(map(int, input().split())) l, r = 1, 10 ** 9 while l < r: m = (l + r) // 2 if sum(map(lambda v: (v - 1) // m, a)) > k: l = m + 1 else: r = m print(l)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
94
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N, K = map(int, input().split()) A = list(map(int, input().split())) de...
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N, K = map(int, input().split()) A = list(map(int, input().split())) de...
[["-", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 432, 0, 664, 28, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612]]
5
145
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define rc(x) return cout << x << endl, 0 #define pb push_back #define mkp make_pair #define in insert #define er erase #define fd find #define fr first #define sc second #define all(x) x.begin(), x.end() #define lun(x) (int)x.size...
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define rc(x) return cout << x << endl, 0 #define pb push_back #define mkp make_pair #define in insert #define er erase #define fd find #define fr first #define sc second #define all(x) x.begin(), x.end() #define lun(x) (int)x.size...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
284
N, K = map(int, input().split()) A = list(map(int, input().split())) l = 0 r = max(A) while l != r: mid = (r + l) // 2 count = 0 for log in A: if log > mid: count += (log - 1) // mid if count <= K: r = mid else: l = mid + 1 print(r)
N, K = map(int, input().split()) A = list(map(int, input().split())) l = 1 r = max(A) while l != r: mid = (r + l) // 2 count = 0 for log in A: count += (log - 1) // mid if count <= K: r = mid else: l = mid + 1 print(r)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 52, 8, 196, 0, 7, 0, 102], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
97
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define rep(i, a, b, c) for (ll i = (a); i <= (b); i += (c)) #define repb(i, a, b, c) for (ll i = (a); i >= (b); i -= (c)) #define MOD 1000000007 #define inf 3e18 #define ld long double #define mp make_pair #define vpll vector<pair<...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define rep(i, a, b, c) for (ll i = (a); i <= (b); i += (c)) #define repb(i, a, b, c) for (ll i = (a); i >= (b); i -= (c)) #define MOD 1000000007 #define inf 3e18 #define ld long double #define mp make_pair #define vpll vector<pair<...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
783
N, K = map(int, input().split()) A = list(int(a) for a in input().split()) def can_cut(n): tmp = 0 for a in A: tmp += ((a + n - 1) // n) - 1 if tmp <= K: return True else: return False l = 1 r = max(A) while l+1 < r: m = (l + r) // 2 if can_cut(m): r = m els...
N, K = map(int, input().split()) A = list(int(a) for a in input().split()) def can_cut(n): tmp = 0 for a in A: tmp += ((a + n - 1) // n) - 1 if tmp <= K: return True else: return False l = 0 r = max(A) + 1 while l+1 < r: m = (l + r) // 2 if can_cut(m): r = m ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
118
import numpy as np import math N,K=map(int,input().split()) A=list(map(int,input().split())) def isOK(minVal): tmpK=0 for a in A: # math.ceil(a//minVal)-1 tmpK+=((-(-a//minVal))-1) if tmpK <= K: return True else: return False ok = max(A) ng = 0 while (math.ceil(ok) != math.ceil(ng)): mid = (ok+ng) / 2...
import numpy as np import math N,K=map(int,input().split()) A=list(map(int,input().split())) def isOK(minVal): tmpK=0 for a in A: # math.ceil(a//minVal)-1 tmpK+=((-(-a//minVal))-1) if tmpK <= K: return True else: return False ok = max(A) ng = 0 while (math.ceil(ok) != math.ceil(ng)): mid = (ok+ng) / 2...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
144
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define ll long long #define mk make_pair template <class key, class cmp = std::less<key>> using ordered_set = tree<key, null_type, cmp, rb_...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define ll long long #define mk make_pair template <class key, class cmp = std::less<key>> using ordered_set = tree<key, null_type, cmp, rb_...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
262
#include <bits/stdc++.h> using namespace std; #define ll long long // #define endl '\n' void max_self(int &a, int b) { a = max(a, b); } void min_self(int &a, int b) { a = min(a, b); } int n, k; vector<int> v; bool good(int x) { int cnt = k; for (int i = 0; i < n; i++) { cnt -= (v[i] - 1) / x; } return c...
#include <bits/stdc++.h> using namespace std; #define ll long long // #define endl '\n' void max_self(int &a, int b) { a = max(a, b); } void min_self(int &a, int b) { a = min(a, b); } int n, k; vector<int> v; bool good(int x) { int cnt = k; for (int i = 0; i < n; i++) { cnt -= (v[i] - 1) / x; } return c...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
256
#include <bits/stdc++.h> using namespace std; #define ll long long ll cnt(vector<int> &xs, int x) { int n = xs.size(); ll ans = 0; for (int i = 0; i < n; i++) { ans += xs[i] / x; } return ans; } int main() { ios::sync_with_stdio(0); int n; cin >> n; int k; cin >> k; vector<int> xs(n); fo...
#include <bits/stdc++.h> using namespace std; #define ll long long ll cnt(vector<int> &xs, int x) { int n = xs.size(); ll ans = 0; for (int i = 0; i < n; i++) { ans += (xs[i] - 1) / x; } return ans; } int main() { ios::sync_with_stdio(0); int n; cin >> n; int k; cin >> k; vector<int> xs(n)...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
214
# coding: utf-8 # Your code here! N,K=map(int,input().split()) A=list(map(float, input().split())) low=-1 high=10**9+1 while high-low!=1: mid=(high+low)//2 cut_temp=0 ans=-1 for a in A: cut_temp+=-(-a//mid)-1 if cut_temp>K: low=mid else: high=mid print(high)
# coding: utf-8 # Your code here! N,K=map(int,input().split()) A=list(map(float, input().split())) low=0 high=10**9+1 while high-low!=1: mid=(high+low)//2 cut_temp=0 ans=-1 for a in A: cut_temp+=-(-a//mid)-1 if cut_temp>K: low=mid else: high=mid print(high)
[["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
102
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 200000; int N, K; int A[MAX]; bool check(int len) { int c = 0; for (int i = 0; ...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 200000; int N, K; int A[MAX]; bool check(int len) { int c = 0; for (int i = 0; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
213