prompt
string
response
string
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class C { void solve() throws Exception { int n = nextInt(); int[] x = nextInts(n); ArrayList[] piles = new ArrayList[n]; for (int i=0; i<n; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = input() boxes = map(int, raw_input().split()) s = [0 for i in range(101)] e = [0 for i in range(102)] for b in boxes : s[b] += 1 e[1] = s[0] for i in range(1, 101) : if s[i] == 0 : pass else : for j in range(1, i+1) : # print '[%d %d] %d %d' % (i, j, s[i], e[j]) ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n, i, j, T, a[200], top[200]; int main() { scanf("%d\n", &n); for (i = 1; i <= n; i++) scanf("%d", a + i); sort(a + 1, a + n + 1); top[T = 1] = 0; for (i = 2; i <= n; i++) { for (j = 1; j <= T; j++) if (top[j] < a[i]) { top[j]++; brea...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
a=int(input()) z=list(map(int,input().split())) from bisect import * z.sort() index=0 count=0 while(len(z)): r=bisect_left(z,index) if(r==len(z)): count+=1 index=0 else: index+=1 z.pop(r) print(count+1)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; int n, v[102]; bool tk[102]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); cin >> n; for (int i = 1; i <= n; ++i) cin >> v[i]; sort(...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; import java.io.*; public class fast{ static class Parser { final int BUFFER_SIZE = 1 << 16; DataInputStream din; byte[] buffer; int bufferPointer, bytesRead; public Parser(InputStream in) { din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } publ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
N = int(raw_input()) X = [int(s) for s in raw_input().split()] X.sort() for res in range(1, N + 1): for (i, x) in enumerate(X): if i / res > x: break else: print res exit(0)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int piles = 1, heavy = 0, num; int a[110], n; void solve(int x) { if (num == 0) { return; } if (heavy <= a[x]) { a[x] = -1; heavy++; num--; solve(x + 1); } else if (x < n) { solve(x + 1); } else { for (int i = 1; i <= n; i++) { if...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(raw_input()) N=map(int,raw_input().split()) N.sort() u=ans=0 while u<n: ans+=1 h=0 for i in range(n): if N[i]>=h: N[i]= -1 h+=1 u+=1 print ans
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Task388A { public static void main(String... args) throws NumberFormatException, IOException { Solutio...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int a[1010]; int main() { int n, i; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; int x; for (int i = 0; i < n; i++) { x = 1; if (a[i] >= 0) { ans++; for (int j = i + 1; j < n; j++) { if (a[j] >= x) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] boxList = new int[n]; int[] boxKeyList = new int[n]; int maxList = 0; for (int i = 0; i ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n; int x[100 + 5]; int main() { for (int i = 0; i < 105; ++i) { x[i] = 0; } cin >> n; int now; for (int i = 0; i < n; ++i) { cin >> now; x[now]++; } int ans = 0, cnt = 0, level; while (cnt < n) { level = 0; for (int i = 0; i <= 100; +...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Abood2C { public static void main(String[] args) throws IO...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, p, q, s, j, m, x; int a[101] = {0}; int b[101] = {0}; cin >> n; m = 0; for (i = 1; i <= n; i++) { cin >> x; m = max(m, x); a[x]++; } s = 0; for (i = 1; i <= a[0]; i++) b[i] = 1; if (a[0] > s) s = a[0]; for (i = 1; i <...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n,a,c = input(),sorted(map(int,raw_input().split())),[0]*110 for v in a: mx = 0 for i in range(1,v+1): if c[i]: mx = i; break c[mx] -= 1; c[mx+1] += 1 print sum(c[1:])
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(input()) a=list(map(int,input().split())) a.sort() piles=0 for i in range(n): if piles*(a[i]+1)<=i: piles+=1 print(piles)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(Strin...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; vector<long long> a(101); long long n; bool f(long long x) { vector<vector<long long> > mas(101); long long i, j; for (i = 0; i < n; i++) { long long num = i % x; mas[num].push_back(a[i]); } for (i = 0; i < x; i++) { for (j = 0; j < mas[i].size(); j++)...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int a[110]; int h[110]; int main() { int i, j, tail, k, n, m; memset(h, 0, sizeof(h)); scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); tail = 0; sort(a, a + n); for (i = 0; i < n; i++) { int flag = 0; for (j = 0; j < tail; j++) { if ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
from sys import stdin n=int(input()) a= list(map(int,stdin.readline().split())) a.sort() piles=0 i=0 while len(a)>0: piles+=1 boxes=1 i=0 del a[0] while i<len(a): if a[i]>=boxes: boxes+=1 del a[i] else: i+=1 print(piles)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; int n; vector<int> v; bool comp(int a, int b) { return a > b; } bool check(int mid) { vector<int> f(mid); for (int i = 0; i < mid; i++) f[i] = v[i]; for (int i = mid; i < n; i++) { if (f[i % mid] > 0) f[i % mid] = min(f[i % mid] - 1,...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) a = list(map(int, input().split())) d = [0] * 101 for i in a: d[i] += 1 p = 0 while True: allZeros = True k = 0 for i in range(101): if d[i] != 0: while i >= k and d[i] > 0: d[i] -= 1 k += 1 allZeros = False if allZeros...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n, x[100], height[100], ans = 0; cin >> n; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); for (int i = 0; i < n; i++) { bool find = false; for (int j = 0; j < ans; j++) { if (height[j] <= x[i]) { find = true; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (!b) return a; return gcd(b, a % b); } long long int power(long long int x, long long int y, long long int p) { long long int res = 1; x %= p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >>...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import collections, bisect, heapq n = int(input()) arr = list(map(int, input().split())) arr.sort() t = [] for a in arr: if not t or a < t[0]: heapq.heappush(t, 1) else: c = heapq.heappop(t) heapq.heappush(t, c + 1) print(len(t))
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:200000000") using namespace std; const int MOD = 1000000007; int main() { int n; scanf("%d", &n); int a[105]; for (int(i) = 0; (i) < (n); (i)++) scanf("%d", &a[i]); sort(a, a + n); int b[104] = {0}; for (int(i) = 0; (i) < (n); (i)++) { for (int(...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import math n = int(input()) arr = [int(z) for z in input().split()] arr.sort() r = 0 for i in range(n): e = arr[i] k = math.ceil((i+1) / (e+1)) r = max(r, k) print(r)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int arr[105]; bool compare(int x, int y) { return x > y; } bool ok(int x, int n) { int y = 0; int rem[105] = {0}; int i; for (i = 0; i < n; ++i) { if (i > x - 1) { rem[y] = min(rem[y] - 1, arr[i]); if (rem[y] < 0) { return false; } ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def arr_inp(): return [int(x) for x in stdin.readline().split()] from sys import * from collections import deque from bisect import * n, a, ans, all = int(input()), sorted(arr_inp()), 0, [] for i in range(n): if not a[i]: ans += 1 insort_right(all, 1) else: ix = bisect_right(all, ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CopyOfC { public static void main(String[] args) { MyScanner in = new MyScanner(); int n = in.nextInt(); int[] x = new int[n]...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; import java.io.*; public class ultrafast { static class InputReader { private InputStream stream; private byte[] inbuf = new byte[1024]; private int start= 0; private int end = 0; public InputReader(InputStream stream) { this.stream = stream; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, 1, 0, -1}; int dx2[] = {1, -1, -1, 1, 0, 0, -1, 1}; int dy2[] = {1, -1, 1, -1, 1, -1, 0, 0}; int kmx[] = {-1, -1, 1, 1, 2, -2, 2, -2}; int kmy[] = {2, -2, 2, -2, -1, -1, 1, 1}; class Timer { public: clock_t T; Timer() { T = cloc...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class Main { public static void main(String[] args) { InputReader jin = new InputReader(System.in); int n = jin.readInt(); int[] a = new int[n]; int[] count = new int[101]; int[] piles = new in...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; long long pow(long long x, long long y, long long mod) { long long temp; if (y == 0) return 1; temp = (pow(x, y / 2, mod)) % mod; if (y % 2 == 0) return (temp * temp) % mod; else return (((x * temp) % mod) * temp) % mod; } void solve(long long tno) { lon...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(raw_input()) c = [ 0 for i in range(200) ] l = map(int , raw_input().split()) for i in l: c[i] += 1 ans = 0 RANGE = range(101); while True: flag = False for i in RANGE: if c[i]: flag = True cnt = 1 c[i] -= 1 ans += 1 for j in RANGE: while j >= cnt and c[j]: c[j] -= 1 cnt += 1 ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import sys n = int(sys.stdin.readline()[:-1]) a = [ int(i) for i in sys.stdin.readline().split()] a = sorted(a) M = [] for i in range(len(a)): if M == []: newar = [a[i]] M.append(newar) else: minsize = min(M, key = lambda x: len(x)) index = M.index(minsize) if len(minsize) <= a[i]: M[index].append(a[i...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; import java.io.*; public class A{ public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); int ans=0; int []cnt=new int[110]; for(int j=0;j<n;j++) cnt[sc.nextInt()]++; int []pi...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(raw_input()) arr=sorted([int(i) for i in raw_input().split()]) l=[] for x in arr: k=True for i in range(len(l)): if l[i]<=x: l[i]+=1 k=False break if k: l.append(1) print len(l)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
raw_input() A = sorted(map(int, raw_input().split())) ans = 0 while len(A) > 0: c = 0 for i in xrange(len(A)): if A[i] >= c: A[i] = -1 c += 1 A = filter(lambda x: x != -1, A) ans += 1 print ans
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.*; import java.util.*; import java.math.*; public class Main { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub InputStream inputstream = System.in; OutputStream outputstream = System.out; InputReader in = new InputReader(inputstream); Outp...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class CFTest104 { static BufferedReader br; public static void main(String[] args) { br = new BufferedReader(new InputStreamReader(System.in)); try { int n = readInt(); int[] arr...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def solve(): for i in range(1, 101): pile = [0] * i ind = 0 for j in range(n): if pile[ind % i] <= L[j]: pile[ind % i] += 1 ind += 1 else: break else: return i n = input() L = sorted(map(int, raw_inp...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int N = 100; int x[N], n; bool good(int u) { for (int i = 0; i < n; i++) if (x[i] < i / u) return 0; return 1; } int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &x[i]); sort(x, x + n); int l = 1, r = n; while (l < r) { int m...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n, x[101], f[101]; int comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { ios::sync_with_stdio(false); cin >> n; x[0] = 0; for (int i = 1; i <= n; i++) cin >> x[i]; for (int i = 1; i <= n; i++) f[i] = 1; qsort(x, n + 1, sizeof(...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split("\\s"); int N = Integer.parseInt(s[0]); // int Q = Inte...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) x = sorted(list(map(int, input().split()))) ans = 1 for i in range(n): if(x[i] < i//ans): ans += 1 print(ans)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import time,math,bisect,sys from sys import stdin,stdout from collections import deque from fractions import Fraction from collections import Counter from collections import OrderedDict pi=3.14159265358979323846264338327950 def II(): # to take integer input return int(stdin.readline()) def IO(): # to take string in...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int INF = 2147483647; int inf = -2147483648; int dir[8][2] = {-1, 0, 1, 0, 0, -1, 0, 1, -1, -1, 1, 1, 1, -1, -1, 1}; const double PI = acos(-1.0); int a; int mapp[1005]; int main() { ios::sync_with_stdio(false); int n; int cnt = 0; int sum = 0; int sum1 = 0; cin...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(raw_input().strip()) x = map(int, raw_input().strip().split()) x.sort() y = [] for item in x: put = False for i in xrange(len(y)): if y[i] <= item: y[i] += 1 put = True break if not put: y.append(1) print len(y)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; long long int a[400]; long long int h[400]; multiset<long long int> st; int main() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long int n; cin >> n; long long int maxm = 0, l = -1, cnt = 0, lll = 5; for (int i = 0; i < n; i++) cin >> a[i...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int count = 1; for (int i = 1; i < n; i++) { if (a[i] < (i / count)) count++; } cout << count; }
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n; int ans; struct NODE { int w, s; } x[105]; int cmp(const NODE &a, const NODE &b) { if (a.s < b.s) return 1; else if (a.s == b.s) { if (a.w < b.w) return 1; else return 0; } else return 0; } int main() { int i, j, flag; scanf("%...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int a[120], b[120]; int main(void) { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a + n); int sum = 0; while (1) { int st = 0; while (st < n && b[st] != 0) ++st; if (st >= n) break; int d = 0; for (int i = s...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
# Target - Expert on CF # Be Humblefool import sys inf = float("inf") # sys.setrecursionlimit(10000000) # abc='abcdefghijklmnopqrstuvwxyz' # abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, '...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.io.File; import java.util.StringTokenizer; import java.io.Writer; imp...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; bool Can(vector<int> v, int x) { for (int i = 0; i < ((int)(v).size()); i++) if (v[i] < i / x) return false; return true; } int main() { int n; scanf("%d", &n); vector<int> v(n); for (int i = 0; i < n; i++) scanf("%d", v.begin() + i); sort(v.begin(), v.end...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(input()) l=list(map(int,input().split())) l=sorted(l) l=l[::-1] l1=[0]*n k=0 for i in range(n) : if l1[i]!=1 : t=l[i] p=1 r=0 l1[i]==1 V=[t] for j in range(n) : if l1[j]==0 and l[j]<t : t=l[j] l1[j]=1 V...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, a[N]; bool vis[N]; int main(void) { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } sort(a, a + n); int ans = 0; bool flag = true; while (flag) { ans++; int now = 0; for (int i = 0; i < n; i++) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(raw_input()) a = map(int, raw_input().split()) a.sort() b = [] for x in a: for i, y in enumerate(b): if x >= y: b[i] += 1 break else: b.append(1) print len(b)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def check(mid , lis): pile=[10000000000]*mid c=0 for i in range(n-1,-1,-1): pile[i%mid]=min(pile[i%mid]-1,lis[i]) # print(pile,mid) if min(pile)<0: return 0 else: return 1 n = int(input()) lis = sorted(map(int,input().split())) l=1 r=n while l<=r: mid = l + (r-...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(raw_input()) a=map(int,raw_input().split()) a.sort() for ans in range(1,n+1): OK=1 b=[1 for i in range(ans)] j=0 for i in range(ans,n): if a[i]<b[j]: OK=0 break b[j]+=1 j+=1 if j==ans: j=0 if OK: print ans break
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Locale; import java.util.Map; imp...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def check_append(list, elem): if elem >= len(list): # list.append(elem) return True else: return False n = int(input()) a = [int(x) for x in raw_input().split()] a.sort() main = [] for x in a: if len(main) == 0: main.append([x]) else: flag = True for t in...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; vector<int> pile[102], v; int main() { ios_base::sync_with_stdio(false); int n, x; cin >> n; for (int i = 0; i < n; i++) cin >> x, v.push_back(x), pile[i].clear(); sort(v.begin(), v.end()); int ans = 0, box = 0; for (int i = 0; i < n; i++) { x = v[i]; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) boxes = [int(item) for item in input().split(' ')] boxes.sort() stacks = 0 while len(boxes): stacks += 1 n_boxes = [] current_weight = 0 for box in boxes: if box >= current_weight: current_weight += 1 else: n_boxes.append(box) boxes = n_box...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(input()) l=sorted(map(int,input().split())) pile,box=0,n visited=[0]*n while box!=0: t=0 for i in range(n): if l[i]>=t and visited[i]==0: visited[i]=1 t+=1 box-=1 if t>0: pile+=1 print(pile)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
# Description of the problem can be found at http://codeforces.com/problemset/problem/388/A n = int(input()) l_b = list(map(int, input().split())) l_b.sort() p = 0 s_d = list() while len(l_b) > 0: t = 0 for i, b in enumerate(l_b): if b >= t: s_d.append(i) t += 1 for i in...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(raw_input()) a = map(int, raw_input().split()) a.sort() count = [0] * 200 for elem in a: i = 0 while count[i] > elem: i += 1 count[i] += 1 answer = 0 i = 0 while count[i] > 0: i += 1 print i
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; import java.io.*; public class Main388A { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] a=sc.nextIntArray(n); Arrays.sort(a); int cnt=0; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
__author__ = 'Shailesh' n = int(raw_input()) data = sorted(map(int, raw_input().split())) height = 1 piles = 1 i = 1 while i < len(data): if data[i] < height: piles += 1 i += height continue i += piles height += 1 print piles
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) l = [int(i) for i in input().split()] l.sort() ans = 1 for i in range(n): if l[i] < i//ans: ans+=1 print(ans)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
input();print-~max(x/-~f for x,f in enumerate(sorted(map(int,raw_input().split()))))
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int inf = 0x7FFFFFFF; struct point_int { int x, y; point_int() {} point_int(int a, int b) { x = a, y = b; } }; struct point_double { double x, y; point_double() {} point_double(double a, double b) { x = a, y = b; } }; struct Node { int v, w; Node() {} ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.*; import java.util.*; public class CodeforcesRound228Div2ProblemC { static class Problem { Scanner reader; PrintWriter writer; Problem() { reader = new Scanner(System.in); writer = new PrintWriter(System.out); } Problem(File inputFile,...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0, c = 0; int a[123]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { if (a[i] != -1) { a[i] = -1; c++; for (int j = i + 1; j < n; j++) { if (a[j] >= c) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) a = list(map(int, input().split())) a = sorted(a) k = 0 for i in range(n): if k * (a[i] + 1) <= i: k += 1 print(k)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:16777216") const double EPS = 1e-7; double iabs(const double a) { return (a < -EPS) ? -a : a; } double imin(const double a, const double b) { return (a - b > EPS) ? b : a; } double imax(const double a, const double b) { return (a - b > EPS) ?...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> const int INF = 0x7F7F7F7F; const double EPS = 1e-10; const long long mod7 = 1e9 + 7; const long long mod9 = 1e9 + 9; using namespace std; inline long long rit() { long long f = 0, key = 1; char c; do { c = getchar(); if (c == '-') key = -1; } while (c < '0' || c > '9'); do { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; public class C389C { public static void main(String[] args) { Scanner ah = new Scanner(System.in); int n = ah.nextInt() , i , j , k , s = 0, a [] = new int[n]; for(i = 0;i < n;i ++)a[i] = ah.nextInt(); Arrays.sort(a); boolean b[] = new boolean[n]; for(i = 0;i < n;i +...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.Arrays; import java.util.Scanner; public class BoxAccumulation { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class C { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // Scanner scan = new Scanner(System.in); // PrintWriter out = ne...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const long long N = 1e10 + 0; deque<long long> v, vc; long long cnt, ans, sum, n, a; map<long long, long long> mp; void DNM() { cin >> n; for (long long i = 0; i < n; i++) { cin >> a; v.push_back(a); } sort(v.begin(), v.end()); for (long long i = 0; i < v....
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n=int(input()) arr=list(map(int,input().split())) arr.sort() for k in range(1,n+1): i=0 v=0 ok=True while i<n: for j in range(i,min(i+k,n)): if arr[j]<v: ok=False break i+=k v+=1 if ok: print(k) exit()
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; // import java.lang.*; import java.io.*; // THIS TEMPLATE MADE BY AKSH BANSAL. public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in))...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int N, S[105]; bool feasible(int pile) { priority_queue<int> pq; for (int i = 0; i < pile; ++i) pq.push(S[N - i - 1]); for (int i = N - pile - 1; i >= 0; --i) { int lim = pq.top(); pq.pop(); if (lim <= 0) return false; pq.push(min(lim - 1, S[i])); } ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def check(s, k): for i in xrange(len(s)): if s[i] < i/k: return False return True def f(n): s = sorted(map(int, raw_input().split())) start, end = 1, n while start < end: mid = (start+end)/2 if check(s, mid): end = mid else: start ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.*; public class C { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); Vector<Pile> list = new Vector<Pile>(); for(int i=0; i<n; i++) list.addElement(new Pile(1, s.nextInt())); Collections.sort(list); int count = 0...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import heapq #br = open('a.in') f = lambda: map(int, raw_input().strip().split()) n, a, b = f()[0], sorted(f()), [] for i in a: h = next((j for j, k in enumerate(b) if k <= i), None) if h is None: heapq.heappush(b, 1) else: b[h] += 1 print len(b)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
//Author: net12k44 import java.io.*; import java.util.*; public class Main{//} static PrintWriter out; static void solve() { int n = in.nextInt(); int a[] = new int [n]; int d[] = new int [n]; for(int i = 0; i < n ;++i) a[i] = in.nextInt(); Arrays.sort(a); int kq = 0; for(int i = 0; i < n; ++i) { boolean...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n,count=1; n=scan.nextInt(); int[] boxes = new int[n]; for(int i=0;i<n;i++){ boxes[i]=scan.nextInt(); ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class A228{ void solve() { int n = ni(); int[] a = ia(n); Arrays.sort(a); for(int i=0;i<n;i++) { if(a[i] < 0) continue; int j = i+1; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); int res = 0; for (int i = 0; i < n; i++) cin >> vec[i]; sort(vec.begin(), vec.end()); int num = 0; bool vis[110] = {0}; for (int a = 0; a < n; a++) { bool ok = 0; num = 0; for (int i = 0; i < n;...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int ri() { int r; cin >> r; return r; } unsigned int rui() { unsigned int r; cin >> r; return r; } long long rl() { long long r; cin >> r; return r; } unsigned long long rul() { unsigned long long r; cin >> r; return r; } double rd() { double r; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.io.UncheckedIOException; import java.util.AbstractMap; import java.util.TreeMap; import java.io.Closeable; import ja...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int a[41111], n, was[41111], cnt; int main(void) { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; while (cnt < n) { int x = 0; for (int i = 0; i < n; i++) if (was[i] == 0 && x <= a[i]) x++, was[i] = 1; cnt += x, a...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
def go(): n = int(input()) a = [int(i) for i in input().split(' ')] a.sort() o = 1 for i in range(n): if(a[i] < i // o): o += 1 return o print(go())
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.*; import java.util.*; import java.lang.*; public class Accumulation { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWr...