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 <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int n; ll k; vector<ll> a; bool check(ll x) { ll tmp = 0; rep(i, n) { tmp += (a[i] - 1) / x; if (tmp > k) return fa...
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int n; ll k; vector<ll> a; bool check(ll x) { ll tmp = 0; rep(i, n) { tmp += (a[i] - 1) / x; if (tmp > k) return fa...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
183
#include <bits/stdc++.h> #define int long long #define x first #define y second #define getbit(x, i) (((x) >> (i)) & 1) using namespace std; typedef pair<int, int> pii; #define hashset unordered_set #define hashmap unordered_map #define newline fast_writechar('\n') #define unify(arr) arr.resize(unique(arr.begin(), arr....
#include <bits/stdc++.h> #define int long long #define x first #define y second #define getbit(x, i) (((x) >> (i)) & 1) using namespace std; typedef pair<int, int> pii; #define hashset unordered_set #define hashmap unordered_map #define newline fast_writechar('\n') #define unify(arr) arr.resize(unique(arr.begin(), arr....
[["-", 0, 16, 31, 16, 12, 74, 51, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 74, 51, 2, 63, 22]]
1
1,023
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (auto &&e : a) { cin >> e; } int upper = *max_element(a.begin(), a.end()) + 1; int lower = -1; while (upper - lower > 1) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (auto &&e : a) { cin >> e; } int upper = *max_element(a.begin(), a.end()); int lower = 0; while (upper - lower > 1) { in...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
191
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define int long long signed main() { // int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int mx...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define int long long signed main() { // int main() { // ios_base::sync_with_stdio(false); // cin.tie(NULL); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int mx...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75,...
1
206
# coding: utf-8 def solve(*args: str) -> str: n, k = map(int, args[0].split()) A = tuple(map(int, args[1].split())) l, r = 0, max(A) while l+0.5 < r: m = (l+r)/2 cnt = 0 for a in A: cnt += -int(-a//m)-1 if k < cnt: l = m else: ...
# coding: utf-8 def solve(*args: str) -> str: n, k = map(int, args[0].split()) A = tuple(map(int, args[1].split())) l, r = 1, max(A) while 0.1 < r-l: m = (l+r)/2 cnt = 0 for a in A: cnt += -int(-a//m)-1 if k < cnt: l = m else: ...
[["-", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612], ["-", 8, 196, 0, 52, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 52, 15, 666, 0, 657, 17, 72], ["-", 8, 196, 0, 52, 15, 666, 0, 657, 12, 531], ["+", 0, 14, 8, 196, 0, 52, 15, 666, 0, 531], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 1...
5
146
# 入力 # 値は全てint # Nは本数、Kは切る回数、AはN本の木のそれぞれの長さ(リスト) N,K = map(int,input().split()) A = list(map(int,input().split())) # 二分探索 # lが左端、rが右端 l,r = 1, 10**9+1 # 整数で返すので、差が1より大きい時はループする while r - l > 1: # 真ん中を設定 x = (r+l) // 2 # 切る回数をc c = 0 for a in A: # それぞれの丸太の(長さ-1)をxで割った値の合計が、切る回数 c +...
# 入力 # 値は全てint # Nは本数、Kは切る回数、AはN本の木のそれぞれの長さ(リスト) N,K = map(int,input().split()) A = list(map(int,input().split())) # 二分探索 # lが左端、rが右端 l,r = 0, 10**9 # 整数で返すので、差が1より大きい時はループする while r - l > 1: # 真ん中を設定 x = (r+l) // 2 # 切る回数をc c = 0 for a in A: # それぞれの丸太の(長さ-1)をxで割った値の合計が、切る回数 c += ...
[["-", 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, 17, 72], ["-", 0, 1, 0, 662, 12, 432, 0, 657, 12, 612]]
5
104
#include <bits/stdc++.h> #define ll long long #define MM(arr, x) memset(arr, x, sizeof(arr)) #define INF 0x3f3f3f3f #define Maxn 1e5 + 10; using namespace std; int a[200050], n, k; bool check(int mid) { int ans = 0; for (int i = 1; i <= n; i++) { if (a[i] > mid) ans += a[i] / mid; if (ans > k) r...
#include <bits/stdc++.h> #define ll long long #define MM(arr, x) memset(arr, x, sizeof(arr)) #define INF 0x3f3f3f3f #define Maxn 1e5 + 10; using namespace std; int a[200050], n, k; bool check(int mid) { int ans = 0; for (int i = 1; i <= n; i++) { if (a[i] > mid) ans += a[i] / mid; if (ans > k) r...
[["-", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72]]
1
205
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define ll long long #define rep(i, n) for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define ll long long #define rep(i, n) for (int i = 0; i <...
[["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
221
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<int64_t> A(N); for (auto &a : A) { cin >> a; } auto f = [&](int64_t x) { int64_t cnt = 0; for (auto a : A) { cnt += a / x; } return cnt <= K; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<int64_t> A(N); for (auto &a : A) { cin >> a; } auto f = [&](int64_t x) { int64_t cnt = 0; for (auto a : A) { cnt += (a - 1) / x; } return cnt <=...
[["+", 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
173
def waru(a,b): if a%b==0: return a//b else: return (a//b)+1 N,K=map(int,input().split()) A=list(map(int,input().split())) ue=sum(A) sita=0 for i in range(40): n=(ue+sita)//2 L=[waru(i,n)-1 for i in A] if sum(L)>K: sita=n else: ue=n if ue==sita: print(ue) exit() elif ue-sita==1: ...
def waru(a,b): if a%b==0: return a//b else: return (a//b)+1 N,K=map(int,input().split()) A=list(map(int,input().split())) ue=sum(A) sita=1 for i in range(50): n=(ue+sita)//2 L=[waru(i,n)-1 for i in A] if sum(L)>K: sita=n else: ue=n if ue==sita: print(ue) exit() elif ue-sita==1: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
184
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,381
n, k = map(int, input().split()) A = tuple(map(int, input().split())) A = sorted(A, reverse=True) l = 1 r = max(A)+1 def cut(l, k): # 長さlの丸太を最大とすることができるかどうかを返す for a in A: if a > l: k -= (-(-a//l) - 1) return k >= 0 while r-l > 1: mid = (r+l)//2 if cut(mid, k): r = mid ...
n, k = map(int, input().split()) A = tuple(map(int, input().split())) A = sorted(A, reverse=True) l = 0 r = max(A)+1 def cut(l, k): # 長さlの丸太を最大とすることができるかどうかを返す for a in A: if a > l: k -= (-(-a//l) - 1) return k >= 0 while r-l > 1: mid = (r+l)//2 if cut(mid, k): r = mid ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
126
n, k = map(int, input().split()) a = list(map(int, input().split())) low = 0 high = max(a) while low + 1 < high: print(low, high) mid = (low + high) // 2 m = 0 for x in a: m += (x - 1) // mid if m <= k: high = mid else: low = mid print(high)
n, k = map(int, input().split()) a = list(map(int, input().split())) low = 0 high = max(a) while low + 1 < high: mid = (low + high) // 2 m = 0 for x in a: m += (x - 1) // mid if m <= k: high = mid else: low = mid print(high)
[["-", 0, 52, 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
98
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pl; #define all(a) (a).begin(), (a).end() #define overload4(_1, _2, _3, _4, name, ...) name #define rep1(n) for (ll i = 0; i < (n); i++) #define rep2(i, n) for (ll i = 0; i < (n); i++) #define rep3(i, a, b) for (ll i = (a); i < (b)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pl; #define all(a) (a).begin(), (a).end() #define overload4(_1, _2, _3, _4, name, ...) name #define rep1(n) for (ll i = 0; i < (n); i++) #define rep2(i, n) for (ll i = 0; i < (n); i++) #define rep3(i, a, b) for (ll i = (a); i < (b)...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]]
1
561
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define m0(x) memset(x, -1, sizeof(x)) const int INF = 1e9 + 1; const ll MOD = 1e9 + 7; const double PI = 3.141592653589793; const int ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define m0(x) memset(x, -1, sizeof(x)) const int INF = 1e9 + 1; const ll MOD = 1e9 + 7; const double PI = 3.141592653589793; const int ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
247
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; int l = 1, r = 1e9; while (r - l > 1) { int cnt = 0; int mid = (l + r) / 2; for ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; int l = 0, r = 1e9; while (r - l > 1) { int cnt = 0; int mid = (l + r) / 2; for ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
165
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int n, k; int a[maxn]; bool check(int mid) { int num = 0; for (int i = 1; i <= n; i++) { num += a[i] / mid + (a[i] % mid != 0) - 1; if (num > k) return false; } return true; } int main() { int l = 0, r, mid; r = 0; s...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int n, k; int a[maxn]; bool check(int mid) { int num = 0; for (int i = 1; i <= n; i++) { num += a[i] / mid + (a[i] % mid != 0) - 1; if (num > k) return false; } return true; } int main() { int l = 1, r, mid; r = 0; s...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
208
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<ll>; using vvi = vector<vi>; using pll = pair<ll, ll>; #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair template <typename T> using vv = vector<vector<T>>; void solve() { int n...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<ll>; using vvi = vector<vi>; using pll = pair<ll, ll>; #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair template <typename T> using vv = vector<vector<T>>; void solve() { int n...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]]
1
234
#coding:utf-8 import math N,K = map(int,input().split()) A = [int(y) for y in input().split()] Ma = max(A) mi = 0 ans = Ma def execute(f): count = 0 for i in A: count += math.ceil(i / f) - 1 if count <= K: return True else: return False while True: median = (Ma + mi) //...
#coding:utf-8 import math N,K = map(int,input().split()) A = [int(y) for y in input().split()] Ma = max(A) mi = 1 ans = Ma def execute(f): count = 0 for i in A: count += math.ceil(i / f) - 1 if count <= K: return True else: return False while True: median = (Ma + mi) //...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
142
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e15; #include <math.h> #define PI 3.14159265358979323846264338327950L const int mxN = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int l = 0, ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e15; #include <math.h> #define PI 3.14159265358979323846264338327950L const int mxN = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int l = 1, ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
186
import sys import math import fractions from collections import defaultdict import heapq from bisect import bisect_left,bisect stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.rea...
import sys import math import fractions from collections import defaultdict import heapq from bisect import bisect_left,bisect stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.rea...
[["+", 0, 677, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 12, 23, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 12, 23, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 677, 12, 23, 0, 657, 31, 23, 0, 25]]
5
195
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { int ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
197
N, K = map(int, input().split()) A = [int(i) for i in input().split()] l = 1 r = 10 ** 9 + 1 while l + 1 < r: p = (l + r) // 2 n = 0 ok = False for v in A: n += (v // p - 1) if not v % p == 0: n += 1 if n > K: break else: ok = True if not o...
N, K = map(int, input().split()) A = [int(i) for i in input().split()] l = 0 r = 10 ** 9 + 1 while l + 1 < r: p = (l + r) // 2 n = 0 ok = False for v in A: n += (v // p - 1) if not v % p == 0: n += 1 if n > K: break else: ok = True if not o...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
118
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int l = 0; // int r = -1; int r = 1000000000; for (int i = 0; i < n; i++) { cin >> a[i]; // r = max(a[i],r); } while (l < r) { int m = l + (r - l) / 2; int cnt = 0; for (int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int l = 1; int r = 1000000000; for (int i = 0; i < n; i++) cin >> a[i]; while (l < r) { int m = l + (r - l) / 2; int cnt = 0; for (int i = 0; i < n; i++) { cnt += (a[i] - 1) / m; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
146
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int l = 0; // int r = -1; int r = 1000000000; for (int i = 0; i < n; i++) { cin >> a[i]; // r = max(a[i],r); } while (l < r) { int m = l + (r - l) / 2; int cnt = 0; for (int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); int l = 1; // int r = -1; int r = 1000000000; for (int i = 0; i < n; i++) { cin >> a[i]; // r = max(a[i],r); } while (l < r) { int m = l + (r - l) / 2; int cnt = 0; for (int i = ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
146
#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>; using G = vector<vector<int>>; int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; ll l = 0, r = 1e9; ll mid = 0; while (r - l > 0) { ...
#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>; using G = vector<vector<int>>; int main() { ll n, k; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; ll l = 0, r = 1e9; ll mid = 0; while (r - l > 1) { ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
197
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
406
// C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #i...
// C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #i...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
344
from collections import defaultdict as dd from collections import deque import bisect import heapq def ri(): return int(input()) def rl(): return list(map(int, input().split())) def solve(): n, k = rl() A = rl() def check(L): cuts = 0 for a in A: cuts += (a - 1) // L...
from collections import defaultdict as dd from collections import deque import bisect import heapq def ri(): return int(input()) def rl(): return list(map(int, input().split())) def solve(): n, k = rl() A = rl() def check(L): cuts = 0 for a in A: cuts += (a - 1) // L...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
183
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define DEBUG(x) cout << #x << "=...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define DEBUG(x) cout << #x << "=...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 79], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 64, 1...
1
552
#include <algorithm> // sort #include <cstring> #include <fstream> #include <iostream> #include <math.h> #include <queue> #include <vector> #define DEBUG 0 #define REP(i, n) for (long long i = 0; i < (n); i++) typedef long long ll; static const ll MOD = 1000000007; static const ll INF = 1000000000000000000LL; // 9999...
#include <algorithm> // sort #include <cstring> #include <fstream> #include <iostream> #include <math.h> #include <queue> #include <vector> #define DEBUG 0 #define REP(i, n) for (long long i = 0; i < (n); i++) typedef long long ll; static const ll MOD = 1000000007; static const ll INF = 1000000000000000000LL; // 9999...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
220
n,k=map(int,input().split()) A = list(map(int, input().split())) r = max(A) l = 0 while l+1<r: mid=(l+r)//2 if sum([a-1]//mid for a in A)>k: l=mid else: r = mid print(r)
n,k=map(int,input().split()) A = list(map(int, input().split())) r = max(A) l = 0 while l+1<r: mid=(l+r)//2 if sum([(a-1)//mid for a in A])>k: l=mid else: r = mid print(r)
[["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 24], ["-", 0, 652, 3, 668, 8, 657, 31, 634, 0, 73], ["+", 3, 4, 0, 658, 8, 657, 31, 23, 0, 25], ["+", 15, 666, 0, 652, 3, 4, 0, 658, 0, 73]]
5
88
#include <bits/stdc++.h> using namespace std; #define ll long long #define dbg puts("It's Just Begining.Wait For The End!!!!!\n") #define CHECK(x) cout << (#x) << " is " << (x) << "\n"; #define endl printf("\n") typedef pair<ll, ll> pii; #define pb push_back #define ms(a, b) memset(a, b, sizeof(a)) #define in(x) scanf(...
#include <bits/stdc++.h> using namespace std; #define ll long long #define dbg puts("It's Just Begining.Wait For The End!!!!!\n") #define CHECK(x) cout << (#x) << " is " << (x) << "\n"; #define endl printf("\n") typedef pair<ll, ll> pii; #define pb push_back #define ms(a, b) memset(a, b, sizeof(a)) #define in(x) scanf(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
359
# 入力:N本ある丸太を合計K回切ることができる N, K = gets.chomp.split.map(&:to_i) # 入力:N本ある丸太それぞれの長さ A = gets.chomp.split.map(&:to_i) # 切り終えたとき最大の丸太の長さの候補 range = [1..A.max] # 長さ候補rangeのそれぞれについて、k回で切れるか二分探索 ans = range.bsearch{|x| A.sum{(_1 - 1) / x} <= K} # 出力 puts ans
# 入力:N本ある丸太を合計K回切ることができる N, K = gets.chomp.split.map(&:to_i) # 入力:N本ある丸太それぞれの長さ A = gets.chomp.split.map(&:to_i) # 長さ候補rangeのそれぞれについて、k回で切れるか二分探索 ans = (1 .. A.max).bsearch{|x| A.sum{(_1 - 1) / x} <= K} # 出力 puts ans
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 0, 493, 0, 662, 12, 516, 0, 70], ["+", 0, 493, 0, 662, 12, 652, 486, 739, 0, 24], ["-", 36, 36, 0, 493, 0, 662, 12, 516, 0, 73], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["-", 36, 36, 0, 493, 0, 662, 12, 65...
4
68
#include <bits/stdc++.h> #define ll long long #define ar array #define AC ios_base::sync_with_stdio(0); const int M = 1e9 + 7; using namespace std; const int N = 200000; int arr[N + 5]; int longest_log = 0; int n, k; bool do_cut(int len) { int cuts = 0; for (int i = 0; i < n; i++) { cuts += (arr[i] - 1) / len;...
#include <bits/stdc++.h> #define ll long long #define ar array #define AC ios_base::sync_with_stdio(0); const int M = 1e9 + 7; using namespace std; const int N = 200000; int arr[N + 5]; int longest_log = 0; int n, k; bool do_cut(int len) { int cuts = 0; for (int i = 0; i < n; i++) { cuts += (arr[i] - 1) / len;...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
200
#最大の最小値を求める問題は二部探索 #最大の最小値がちょうどokとngの境界になる #求める値をlとするとその長さに全ての丸太をきるのに必要な回数を数えることができる #その丸太をきる回数がk回以下であればいい #絶対にだめ→0 絶対にオッケー→max(a) n,k=list(map(int,input().split())) a=list(map(int,input().split())) #丸太をきる回数がk回以下かどうか調べる関数 def check(n): cnt=0 for l in a: if l%n==0: cnt=cnt+l//n-1 else: cnt=cnt+l/...
#最大の最小値を求める問題は二部探索 #最大の最小値がちょうどokとngの境界になる #求める値をlとするとその長さに全ての丸太をきるのに必要な回数を数えることができる #その丸太をきる回数がk回以下であればいい #絶対にだめ→0 絶対にオッケー→max(a) n,k=list(map(int,input().split())) a=list(map(int,input().split())) #丸太をきる回数がk回以下かどうか調べる関数 def check(n): cnt=0 for l in a: if l%n==0: cnt=cnt+l//n-1 else: cnt=cnt+l/...
[["-", 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], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
139
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> ii; #define DEBUG freopen("in.txt", "r", stdin); struct fastio { fastio() { ios::sync_with_stdio(false); cout << setprecision(10) << fixed; cin.tie(0); } }; fastio _fast_io; const int N = 2e5 + 5; int n; l...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> ii; #define DEBUG freopen("in.txt", "r", stdin); struct fastio { fastio() { ios::sync_with_stdio(false); cout << setprecision(10) << fixed; cin.tie(0); } }; fastio _fast_io; const int N = 2e5 + 5; int n; l...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 0, 42, 0, 47], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
243
def resolve(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) import math def isok(n): ndiv = 0 for a in A: if a <= n: continue ndiv += math.ceil(a/n)-1 return True if ndiv <= K else False left = 1 right...
def resolve(): N, K = list(map(int, input().split())) A = list(map(int, input().split())) import math def isok(n): ndiv = 0 for a in A: if a <= n: continue ndiv += math.ceil(a/n)-1 return True if ndiv <= K else False left = 0 right...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
146
#include <bits/stdc++.h> using namespace std; #define N 200010 int main() { cin.tie(0); ios::sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); int low = 0; int high = a[n - 1]; int m = low + (high - low) / 2; ...
#include <bits/stdc++.h> using namespace std; #define N 200010 int main() { cin.tie(0); ios::sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); int low = 0; int high = a[n - 1]; int m = low + (high - low) / 2; ...
[["+", 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
208
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef long double ld; const int INF = 1e9; int main() { ll n, k, t = 0; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; ll l = -1, r = 1e9, m; while (r - l > 1) { m = (l + r) /...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef long double ld; const int INF = 1e9; int main() { ll n, k, t = 0; cin >> n >> k; vector<ll> a(n); rep(i, n) cin >> a[i]; ll l = 0, r = 1e9 + 1, m; while (r - l > 1) { m = (l + r...
[["-", 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
152
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> logs; bool isPossible(int len) { int cuts = 0; for (int l : logs) { cuts += l / len; } return (cuts <= k); } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; logs.resize(n); for (int i...
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> logs; bool isPossible(int len) { int cuts = 0; for (int l : logs) { cuts += (l - 1) / len; } return (cuts <= k); } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; logs.resize(n); for ...
[["+", 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
171
/* AtCoder Beginner Contest 174 - E - Logs https://atcoder.jp/contests/abc174/tasks/abc174_e */ #include <bits/stdc++.h> using namespace std; #define FAST_INP \ ios_base::sync_with_stdio(false); \ cin.tie(NULL)...
/* AtCoder Beginner Contest 174 - E - Logs https://atcoder.jp/contests/abc174/tasks/abc174_e */ #include <bits/stdc++.h> using namespace std; #define FAST_INP \ ios_base::sync_with_stdio(false); \ cin.tie(NULL)...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
176
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. ***********************************************...
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. ***********************************************...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
186
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<double, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) {...
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> int main() { int n, k; cin >> n >> k; vector<int> a(n); rep(i, n) { ci...
[["-", 39, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 51, 218, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 51, 218, 8, 9, 0, 14, 8, 9, 0, 46]]
1
188
import math n, k = map(int, input().split()) A = list(map(int, input().split())) max_len = max(A) def f(x): ans = 0 for a in A: cut_num = math.ceil(a / x) - 1 #print(a, cut_num, a / x) ans += cut_num if ans <= k: return True else: return False left = 1 right = m...
import math n, k = map(int, input().split()) A = list(map(int, input().split())) max_len = max(A) def f(x): ans = 0 for a in A: cut_num = math.ceil(a / x) - 1 #print(a, cut_num, a / x) ans += cut_num if ans <= k: return True else: return False left = 0.001 right...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 531], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
124
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
347
N, K = map(int, input().split()[:2]) arr = list(map(int, input().split()[:N])) def pos(X): sum = 0 for i in arr: sum += int(i/X) if i % X == 0: sum -= 1 return sum <= K low = 0 high = 10 ** 9 mid = 0 ans = 10**9 while low <= high: mid = int((low+high)/2) # print(low,...
N, K = map(int, input().split()[:2]) arr = list(map(int, input().split()[:N])) def pos(X): sum = 0 for i in arr: sum += int(i/X) if i % X == 0: sum -= 1 return sum <= K low = 1 high = 10 ** 9 mid = 0 ans = 10**9 while low <= high: mid = int((low+high)/2) # print(low,...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 679, 17, 354]]
5
141
from math import ceil N,K,*A = map(int, open(0).read().split()) left = 1 right = max(A) while left != right: mid = (left+right) // 2 temp = 0 for x in A: temp += ceil(x/mid) - 1 if temp > K: left = mid + 1 break else: right = mid for i in range(left-1,lef...
from math import ceil N,K,*A = map(int, open(0).read().split()) left = 1 right = max(A) while left != right: mid = (left+right) // 2 temp = 0 for x in A: temp += ceil(x/mid) - 1 if temp > K: left = mid + 1 break else: right = mid for i in range(max(1,left...
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
130
n,k,*a=map(int,open(l:=0).read().split()) r=9**9 while~l+r: x=l+r>>1 if-sum(-b//x+1for b in a)>k:l=x else:r=x print(r)
n,k,*a=map(int,open(l:=0).read().split()) r=10**9 while~l+r: x=l+r>>1 if-sum(-b//x+1for b in a)>k:l=x else:r=x print(r)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612]]
5
74
#abc174_e from math import ceil n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() if k==0: ans=max(a) print(ans) exit() if k==1: if n==1: print(-(-a[0]//2)) exit() ans=max(a[-1]/2,a[-2]) print(ceil(ans)) ok=10**9+1 ng=1 def check(x): k_cnt=0 for...
#abc174_e from math import ceil n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() if k==0: ans=max(a) print(ans) exit() if k==1: if n==1: print(-(-a[0]//2)) exit() ans=max(a[-1]/2,a[-2]) print(ceil(ans)) exit() ok=10**9+1 ng=1 def check(x): k_cn...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
196
N, K = map(int, input().split()) A=list(map(int,input().split())) A.sort() right = A[-1]+1 left = -1 flag = True mid = (left+right)//2 minN = right result = mid while right-left>1 and flag: mid = (left+right)//2 count = 0 for i in A: count += (i-1)//mid if count <= K: right = mid ...
N, K = map(int, input().split()) A=list(map(int,input().split())) A.sort() right = A[-1]+1 left = 0 flag = True mid = (left+right)//2 minN = right result = mid while right-left>1 and flag: mid = (left+right)//2 count = 0 for i in A: count += (i-1)//mid if count <= K: right = mid ...
[["-", 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
135
#include <bits/stdc++.h> using namespace std; long double X[200100]; int N; long long Count(long double len) { long long Ans = 0; for (int i = 0; i < N; i++) { Ans += (long long)(X[i] / len); // Ans+= (ceil(X[i])-1/len); } return Ans; } int main() { long long K; cin >> N >> K; for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; long double X[200100]; int N; long long Count(long double len) { long long Ans = 0; for (int i = 0; i < N; i++) { Ans += (long long)(X[i] / len); // Ans+= (ceil(X[i])-1/len); } return Ans; } int main() { long long K; cin >> N >> K; for (int i = 0; i < ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
186
temparr = input() temparr = temparr.split() n = int(temparr[0]) k = int(temparr[1]) temparr = input() import math temparr = temparr.split() arr = [] for i in temparr: arr.append(int(i)) arr = sorted(arr) #print(arr) left = 0 right = arr[-1] + 1 ans = arr[-1] while left <= right: mid = (left + right) // 2 ...
temparr = input() temparr = temparr.split() n = int(temparr[0]) k = int(temparr[1]) temparr = input() import math temparr = temparr.split() arr = [] for i in temparr: arr.append(int(i)) arr = sorted(arr) #print(arr) left = 1 right = arr[-1] + 1 ans = arr[-1] while left <= right: mid = (left + right) // 2 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
159
import sys def input(): return sys.stdin.readline().strip() def main(): N,K = map(int,input().split()) A = sorted(list(map(int,input().split()))) left = 0 right = A[-1] while right - left > 1: cnt = 0 middle = (left + right) // 2 for i in A: cnt += i // mid...
import sys def input(): return sys.stdin.readline().strip() def main(): N,K = map(int,input().split()) A = sorted(list(map(int,input().split()))) left = 0 right = A[-1] while right - left > 1: cnt = 0 middle = (left + right) // 2 for i in A: cnt += (i - 1) ...
[["+", 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
126
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() l=1 r=a[-1] while r-l>1: cnt=0 m=(l+r)//2 #print("l,m,r",l,m,r) for i in a: cnt+=(i-1)//m if cnt<=k: r=m else: l=m print(r)
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() l=0 r=a[-1] while r-l>1: cnt=0 m=(l+r)//2 #print("l,m,r",l,m,r) for i in a: cnt+=(i-1)//m if cnt<=k: r=m else: l=m print(r)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
99
#include <bits/stdc++.h> using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim > ...
#include <bits/stdc++.h> using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim > ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
537
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int N, K; cin >> N >> K; vector<int> A(N); rep(i, N) { cin >> A[i]; } int l = 1, r = 1e9; while (r - l > 1) { int m = (l + r) / 2; ll now = 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { int N, K; cin >> N >> K; vector<int> A(N); rep(i, N) { cin >> A[i]; } int l = 0, r = 1e9; while (r - l > 1) { int m = (l + r) / 2; ll now = 0; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
161
#import numpy as np #import collections #import math #f = open('./input_E.txt') # #N,K = map(int, f.readline().split()) #A = list(map(int, f.readline().split())) N,K = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) def nibu(small,big,KK,AA): mid = (small+big)//2 k_list = ...
#import numpy as np #import collections #import math #f = open('./input_E.txt') # #N,K = map(int, f.readline().split()) #A = list(map(int, f.readline().split())) N,K = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) def nibu(small,big,KK,AA): mid = (small+big)//2 k_list = ...
[["-", 12, 658, 8, 657, 31, 23, 0, 657, 17, 72], ["+", 12, 658, 8, 657, 31, 23, 0, 657, 17, 33]]
5
158
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
212
// Problem Code: abc174_e #include <algorithm> #include <functional> #include <iostream> #include <vector> using namespace std; int logs(int N, int K, vector<int> &A) { int low, mid, high; low = 1; high = *max_element(A.begin(), A.end()); // helper function auto good = [&](int len) { int cuts = 0; ...
// Problem Code: abc174_e #include <algorithm> #include <functional> #include <iostream> #include <vector> using namespace std; int logs(int N, int K, vector<int> &A) { int low, mid, high; low = 1; high = *max_element(A.begin(), A.end()); // helper function auto good = [&](int len) { int cuts = 0; ...
[["+", 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
201
n,k = map(int,input().split()) A = list(map(int,input().split())) if sum(A)-n <= k: print(1) exit() elif k == 0: print(max(A)) exit() top = 10**9 bottom = 1 def ok(x): res = 0 for a in A: res += a//x return res <= k while top - bottom > 1: mid = (top + bottom)//2 if ok(mid):...
n,k = map(int,input().split()) A = list(map(int,input().split())) if sum(A)-n <= k: print(1) exit() elif k == 0: print(max(A)) exit() top = 10**9 bottom = 1 def ok(x): res = 0 for a in A: res += (a-1)//x return res <= k while top - bottom > 1: mid = (top + bottom)//2 if ok(m...
[["+", 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
130
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <regex> #include <set> #include <stack> #include <st...
[["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46]]
1
341
#!/usr/bin/env python3 import sys input=sys.stdin.readline n,k=map(int,input().split()) arr=list(map(int,input().split())) l=-1 r=max(arr)+1 while r-l!=1: persuit=(r+l)//2 cnt=0 for val in arr: if val<=persuit: continue if val%persuit==0: cnt+=val//persuit-1 ...
#!/usr/bin/env python3 import sys input=sys.stdin.readline n,k=map(int,input().split()) arr=list(map(int,input().split())) l=0 r=max(arr)+1 while r-l!=1: persuit=(r+l)//2 cnt=0 for val in arr: if val<=persuit: continue if val%persuit==0: cnt+=val//persuit-1 ...
[["-", 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
123
import math n, k = map(int, input().split()) a = list(map(int, input().split())) floor = 1 ceil = max(a) def cut(long, logs): cnt = 0 for i in logs: cnt += math.ceil(i / long) - 1 return cnt while ceil - floor > 1: L = (ceil + floor)//2 num = cut(L, a) if num <= k: ceil = L...
import math n, k = map(int, input().split()) a = list(map(int, input().split())) floor = 0 ceil = max(a) def cut(long, logs): cnt = 0 for i in logs: cnt += math.ceil(i / long) - 1 return cnt while ceil - floor > 1: L = (ceil + floor)//2 num = cut(L, a) if num <= k: ceil = L...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
115
import java.io.*; import java.util.*; public class Main { public static boolean pos(int a[], int l, int c) { int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i]; } if (l == 0) return sum <= c; l++; int times = 0; for (int i = 0; i < a.length; i++) { int cut = a...
import java.io.*; import java.util.*; public class Main { public static boolean pos(int a[], int l, int c) { int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i]; } if (l == 0) return sum <= c; int times = 0; for (int i = 0; i < a.length; i++) { int cut = a[i] / l; ...
[["-", 0, 195, 8, 196, 0, 1, 0, 27, 0, 22], ["-", 0, 195, 8, 196, 0, 1, 0, 27, 0, 29], ["-", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 8, 196, 0, 37, 0, 23, 0, 16, 17, 47], ["+", 8, 196, 0, 37, 0, 23, 0, 16, 17, 20], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499]]
3
928
def main(): import sys def input(): return sys.stdin.readline().rstrip() n , k = map(int, input().split()) a = list(map(int, input().split())) l = 0 r = max(a) while l < r: m = (l+r)//2 cnt = 0 for x in a: cnt += (x-1)//m if cnt > k: l = m+1 ...
def main(): import sys def input(): return sys.stdin.readline().rstrip() n , k = map(int, input().split()) a = list(map(int, input().split())) l = 1 r = max(a) while l < r: m = (l+r)//2 cnt = 0 for x in a: cnt += (x-1)//m if cnt > k: l = m+1 ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
126
import sys input = sys.stdin.readline def judge(x): cnt = 0 for Ai in A: cnt += (Ai+x-1)//x-1 return cnt<=K def binary_search(): l, r = 0, 10**9+100 while l<=r: m = (l+r)//2 if judge(m): r = m-1 else: l = m+1 ...
import sys input = sys.stdin.readline def judge(x): cnt = 0 for Ai in A: cnt += (Ai+x-1)//x-1 return cnt<=K def binary_search(): l, r = 1, 10**9+100 while l<=r: m = (l+r)//2 if judge(m): r = m-1 else: l = m+1 ...
[["-", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612]]
5
129
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<ll, ll>; #define For(i, a, b) for (int i = a; i <= b; i++) #define Forr(i, a, b) for (int i = a; i >= b; i--) #define F first #define S second #define eb emplace_back #define all(x) x.begin(), x.end() #d...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<ll, ll>; #define For(i, a, b) for (int i = a; i <= b; i++) #define Forr(i, a, b) for (int i = a; i >= b; i--) #define F first #define S second #define eb emplace_back #define all(x) x.begin(), x.end() #d...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
485
/** * author : Saurav Paul * created : August 03, 2020 11:41 AM * Problem Name : E - Logs * Problem Limit : 2000 ms , 1024 MB * Problem Url : https://atcoder.jp/contests/abc174/tasks/abc174_e * @genarated by : ai-virtual-assistant **/ #include <bits/stdc++.h> using namespace s...
/** * author : Saurav Paul * created : August 03, 2020 11:41 AM * Problem Name : E - Logs * Problem Limit : 2000 ms , 1024 MB * Problem Url : https://atcoder.jp/contests/abc174/tasks/abc174_e * @genarated by : ai-virtual-assistant **/ #include <bits/stdc++.h> using namespace s...
[["-", 8, 123, 0, 171, 0, 124, 39, 86, 0, 96], ["-", 0, 122, 8, 123, 0, 171, 0, 124, 49, 120], ["-", 0, 122, 8, 123, 0, 171, 0, 124, 0, 32], ["-", 0, 122, 8, 123, 0, 171, 0, 124, 365, 13], ["-", 0, 122, 8, 123, 0, 171, 0, 124, 0, 21], ["-", 0, 122, 8, 123, 0, 171, 0, 124, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]...
1
559
#include <algorithm> #include <iostream> #include <vector> // #include<queue> // #include<set> #include <cmath> /******/ // during contest /* void stupid(){ int N,K; std::cin>>N>>K; // std::vector<long double> v(N); std::multiplies<long double> v; long double buf; // std::queue<long double> ...
#include <algorithm> #include <iostream> #include <vector> // #include<queue> // #include<set> #include <cmath> /******/ // during contest /* void stupid(){ int N,K; std::cin>>N>>K; // std::vector<long double> v(N); std::multiplies<long double> v; long double buf; // std::queue<long double> ...
[["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
337
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, m, r, a[222222], l = 1e9, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cin >> n >> m; l = 1; for (int i = 1; i <= n; i++) { cin >> a[i]; r = max(a[i], r); } ans = r; while (l <= r) { double mid = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, m, r, a[222222], l = 1e9, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cin >> n >> m; l = 1; for (int i = 1; i <= n; i++) { cin >> a[i]; r = max(a[i], r); } ans = r; while (l <= r) { ll mid = l + ...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]]
1
175
#coding: utf-8 N, K = (int(n) for n in input().split()) A = [int(n) for n in input().split()] def is_ok(X): ret = 0 for log in A: ret += -(-log//X) - 1 return ret <= K def meguru_bisect(ng, ok): ''' 初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す まずis_okを定義すべし ng ok は とり得る最小の値-1 とり得る最大の値+1 ...
#coding: utf-8 N, K = (int(n) for n in input().split()) A = [int(n) for n in input().split()] def is_ok(X): ret = 0 for log in A: ret += -(-log//X) - 1 return ret <= K def meguru_bisect(ng, ok): ''' 初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す まずis_okを定義すべし ng ok は とり得る最小の値-1 とり得る最大の値+1 ...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
128
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 2e5 + 4; int n; ll m; double a[N]; double l = 1e9, r = 0; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-')...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 2e5 + 4; int n; ll m; double a[N]; double l = 1e9, r = 0; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-')...
[["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
1
380
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef long long ll; typedef pair<ll, ll> P; int main() { ll n, k; cin >> n >> k; ll a[200020]; rep(i, 0, n) cin >> a[i]; ll r = 1e9, l = 1; while (r > l + 1) { ll mid = (l + r) / 2; ll cn = 0;...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef long long ll; typedef pair<ll, ll> P; int main() { ll n, k; cin >> n >> k; ll a[200020]; rep(i, 0, n) cin >> a[i]; ll r = 1e9, l = 0; while (r > l + 1) { ll mid = (l + r) / 2; ll cn = 0;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
153
def check(numbers, threshold): total = 0 for number in numbers: d, m = divmod(number, threshold) if m == 0: d -= 1 total += d return total def main(): n, k = map(int, input().rstrip().split(" ")) numbers = list(map(int, input().rstrip().split("...
def check(numbers, threshold): total = 0 for number in numbers: d, m = divmod(number, threshold) if m == 0: d -= 1 total += d return total def main(): n, k = map(int, input().rstrip().split(" ")) numbers = list(map(int, input().rstrip().split("...
[["-", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612]]
5
164
//----------------------- // author : xyqkoala // time : 2020-08-03 //----------------------- #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typede...
//----------------------- // author : xyqkoala // time : 2020-08-03 //----------------------- #include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typede...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
272
import sys,bisect,string,math,time,functools,random,fractions from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter from itertools import permutations,combinations,groupby rep=range;R=range def Golf():n,*t=map(int,open(0).read().split()) def I():return int(input()) def S_():return...
import sys,bisect,string,math,time,functools,random,fractions from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter from itertools import permutations,combinations,groupby rep=range;R=range def Golf():n,*t=map(int,open(0).read().split()) def I():return int(input()) def S_():return...
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 531], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 531]]
5
1,740
import math n, k = list(map(int,input().split())) a = list(map(int,input().split())) def lte_k(x, len_list): counter = 0 for item in len_list: counter += math.ceil(item / x) - 1 return counter <= k def binary_search(): low = 1 high = max(a) while low < high-1: mid = (low + hig...
import math n, k = list(map(int,input().split())) a = list(map(int,input().split())) def lte_k(x, len_list): counter = 0 for item in len_list: counter += math.ceil(item / x) - 1 return counter <= k def binary_search(): low = 0 high = max(a) while low < high-1: mid = (low + hig...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
127
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; int n, k, a[MAXN]; bool can(int L) { long long sum = 0; for (int i = 0; i < n; i++) { sum += (a[i] - 1) / L; } if (sum > k) return false; else return true; } int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; int n, k, a[MAXN]; bool can(int L) { long long sum = 0; for (int i = 0; i < n; i++) { sum += (a[i] - 1) / L; } if (sum > k) return false; else return true; } int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
185
#include <bits/stdc++.h> using namespace std; #define task "atcoder" #define lwb lower_bound #define upb upper_bound #define ar array #define fi first #define se second #define ALL(v) (v).begin(), (v).end() typedef long double ld; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; const ...
#include <bits/stdc++.h> using namespace std; #define task "atcoder" #define lwb lower_bound #define upb upper_bound #define ar array #define fi first #define se second #define ALL(v) (v).begin(), (v).end() typedef long double ld; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; const ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
310
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define REP(i, x, n) for (ll i = x; i < n; i++) #define SZ(v) (ll) v.size() #define endl "\n" #define ff first #define ss second #define PQ_MIN priority_queue<ll, vector<ll>, greater<ll>> #def...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define REP(i, x, n) for (ll i = x; i < n; i++) #define SZ(v) (ll) v.size() #define endl "\n" #define ff first #define ss second #define PQ_MIN priority_queue<ll, vector<ll>, greater<ll>> #def...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
702
// C++ 14 #include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]"; return os; } template <typename T> void print(T v, stri...
// C++ 14 #include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]"; return os; } template <typename T> void print(T v, stri...
[["+", 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
300
#include <bits/stdc++.h> #pragma GCC optimize(2) #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define eps 0.000000001 #define pb push_back #define mem(a, b) memset(a, b, sizeof(a)) #define IO ...
#include <bits/stdc++.h> #pragma GCC optimize(2) #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define eps 0.000000001 #define pb push_back #define mem(a, b) memset(a, b, sizeof(a)) #define IO ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
212
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() def counter(x): cnt=0 for i in a: cnt+=i//x if cnt<=k: return True else: return False high=a[-1] low=0 while (high-low)>1: mid =(high+low)//2 if counter(mid): high=mid else: low=mid print(high)
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() def counter(x): cnt=0 for i in a: cnt+=(i-1)//x if cnt<=k: return True else: return False high=a[-1] low=0 while (high-low)>1: mid =(high+low)//2 if counter(mid): high=mid else: low=mid print(high)
[["+", 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
114
n, k = gets.split.map(&:to_i) a = gets.split.map(&:to_i) l = 0 r = a.max while l < r m = (l + r) / 2 sum = 0 a.each {|e| sum += (e.fdiv(m) - 1).ceil} sum > k ? l = m + 1 : r = m end p l
n, k = gets.split.map(&:to_i) a = gets.split.map(&:to_i) l = 1 r = a.max while l < r m = (l + r) / 2 sum = 0 a.each {|e| sum += (e.fdiv(m) - 1).ceil} sum > k ? l = m + 1 : r = m end p l
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
86
/* :: :: ': : :. : ;' :: :: ' ...
/* :: :: ': : :. : ;' :: :: ' ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
212
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
[["+", 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
323
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m, a[N]; bool check(int x) { int y = m; for (int i = 1; i <= n; i++) y -= a[i] / x; return y >= 0; } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); int l = 1, r = 1e9...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m, a[N]; bool check(int x) { int y = m; for (int i = 1; i <= n; i++) { y -= (a[i] - 1) / x; } return y >= 0; } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); int l ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 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, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
184
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, const T &t) { return v2<T>(r, vector<T>(c, t)); } #define F first #define S second int n, k; vector<int> a; bool works...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <typename T> using v2 = vector<vector<T>>; template <typename T> inline v2<T> fill(int r, int c, const T &t) { return v2<T>(r, vector<T>(c, t)); } #define F first #define S second int n, k; vector<int> a; bool works...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
351
#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>; // judge possibility: all logs are cut into less tha Lmax within K steps bool OK_cut_less_than(int Lmax, int K, vector<int> &a) { int count = 0; for (int l : a) { // cut...
#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>; // judge possibility: all logs are cut into less tha Lmax within K steps bool OK_cut_less_than(int Lmax, int K, vector<int> &a) { int count = 0; for (int l : a) { // cut...
[["+", 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
258
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; int N, K; bool f(vector<ll> &A, ll mid) { int cnt = 0; REP(i, A.size()) { ll tmp = A[i]; cnt += tmp / mid; if (cnt > K) return false; } if (cnt > K...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; int N, K; bool f(vector<ll> &A, ll mid) { ll cnt = 0; REP(i, A.size()) { ll tmp = A[i]; cnt += (tmp - 1) / mid; if (cnt > K) return false; } if (cn...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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
220
//#include <bits/stdc++.h> #include <iostream> #include <queue> #include <string> #include <vector> // Some constants don't work #ifndef INT_MAX #define INT_MAX 2147483647 #endif #ifndef INT_MIN #define INT_MIN -2147483648 #endif // short hand tricks typedef long long ll; using namespace std; int main(int argc, char...
//#include <bits/stdc++.h> #include <iostream> #include <queue> #include <string> #include <vector> // Some constants don't work #ifndef INT_MAX #define INT_MAX 2147483647 #endif #ifndef INT_MIN #define INT_MIN -2147483648 #endif // short hand tricks typedef long long ll; using namespace std; int main(int argc, char...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
216
#include <bits/stdc++.h> using namespace std; vector<int> a; int n, k; bool ok(int c) { int ans = 0; for (int &x : a) ans += (x - 1) / c; return ans <= k; } int main() { cin >> n >> k; a = vector<int>(n); for (int &x : a) cin >> x; int lb = 1, rb = 1e9; while (lb < rb) { int mb = (lb + rb) /...
#include <bits/stdc++.h> using namespace std; vector<int> a; int n, k; bool ok(int c) { int ans = 0; for (int &x : a) ans += (x - 1) / c; return ans <= k; } int main() { cin >> n >> k; a = vector<int>(n); for (int &x : a) cin >> x; int lb = 1, rb = 1e9; while (lb < rb) { int mb = (lb + rb) /...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
1
144
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
/* _ __ _ _____ _____ _____ ___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ | / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ / / / / / / / | (__| |_| | |_) | __/ _| | | __/ (_| | < / / / / / / \___|\__,_|_.__/ \___|_| |_| \___|\__,_|_|\_\ ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,688
#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 rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ ...
#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 rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
327
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define int long long #define ll lo...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define int long long #define ll lo...
[["+", 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
508
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair<ll, ll> #define SZ(x) ((int)(x).size()) // #define endl "\n" #define vvi vector<vector<int>> #define vvl vector<vector<long long>> ll mod = 1e9 + 7; // const double pi = acos(-1.0); /* ll kmp(string x) { ll n=...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pii pair<ll, ll> #define SZ(x) ((int)(x).size()) // #define endl "\n" #define vvi vector<vector<int>> #define vvl vector<vector<long long>> ll mod = 1e9 + 7; // const double pi = acos(-1.0); /* ll kmp(string x) { ll n=...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
261
//*********************** // Author:kibi11 // Quarantine Days //*********************** #include "bits/stdc++.h" using namespace std; #define ll long long #define N 2e5 + 1 #define MOD 1000000007 #define dd double #define fr(i, n) for (int i = 0; i < n; i++) #define fr1(i, a, b) for (int i = a; i < b; i++) #define frr...
//*********************** // Author:kibi11 // Quarantine Days //*********************** #include "bits/stdc++.h" using namespace std; #define ll long long #define N 2e6 + 1 #define MOD 1000000007 #define dd double #define fr(i, n) for (int i = 0; i < n; i++) #define fr1(i, a, b) for (int i = a; i < b; i++) #define frr...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
607
/*input 10 10 158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202 */ #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 int long long #define double long double #d...
/*input 10 10 158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202 */ #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 int long long #define double long double #d...
[["+", 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
502
import os import sys from io import BytesIO, IOBase from math import ceil def possible(logs, k, ans): for l in logs: k -= ceil(l/ans) - 1 return k>=0 def main(): n, k = map(int, input().split()) logs = list(map(int, input().split())) l = 0 r = max(logs) + 1 while l < r: ...
import os import sys from io import BytesIO, IOBase from math import ceil def possible(logs, k, ans): for l in logs: k -= ceil(l/ans) - 1 return k>=0 def main(): n, k = map(int, input().split()) logs = list(map(int, input().split())) l = 1 r = max(logs) + 1 while l < r: ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
595