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...
n=int(input()) s=[int(c) for c in input().split()] s.sort() s.reverse() ans=1 def f(a): i=0 b=True while i<len(a) and b: if a[i]<len(a)-i-1: b=False return b i+=1 return b while True: p=[[] for i in range(ans)] i=0 while i<n: p[i%ans].append(...
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() unq, ans, req = set(arr), 1, 0 for ele in unq: count = arr.count(ele) req += count if req//(ele+1) != req/(ele+1): ans = max(1 + req//(ele+1), ans) else: ans = max(req//(ele+1), ans) 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...
n=input() d=sorted(map(int,raw_input().split())) for k in range(1,101): b=1 for i in range(n): if d[i] < i/k: b=0 if b: print k 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...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import java.util.Map.Entry; public class zz{ public static void main(String[] args) throws IOException{ MScanner sc = new MScanner(System...
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() { ios_base::sync_with_stdio(0); int n, arr[200]; while (cin >> n) { int ans = 0, arr1[200]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); for (int i = 0; i < n; i++) { bool flag = 0; for (int j = 0; j < ans; 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...
R=lambda:map(int,raw_input().split()) n = input() a = R() a.sort() res = 1 l = [[a[0]]] for i in range(1, n): ins = False for j in range(len(l)): if len(l[j]) <= a[i]: l[j].append(a[i]) ins = True break if not ins: l.append([a[i]]) 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...
#include <bits/stdc++.h> using namespace std; int data[100]; int freq[101]; int min(int a, int b) { if (a < 0) return 0; if (b < 0) return 0; if (a < b) return a; return b; } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", data + i); for (int i = 0; i < 101; i++) freq[i] = 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; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } const int INF = 1 << 29; inline int two(int n) { return 1 << n; } inline int test(int n, int b) { return (n >> b) & 1; } inline void set_bit(int& n, int b) { n |= two(b); } inline void unset_bit(int& n, int 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...
#include <bits/stdc++.h> using namespace std; int a[110]; int vis[110]; int n; int main() { int i, j; while (scanf("%d", &n) != EOF) { memset(vis, 0, sizeof(vis)); for (i = 1; i <= n; i++) { scanf("%d", &a[i]); } sort(a + 1, a + n + 1); int ans = 0; int cnt = 0; for (i = 1; 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 main() { vector<int> v1, v2; int n, ctr, counter, flag; cin >> n; v1.resize(n); v2.resize(n); for (int i = 0; i < n; i++) { cin >> v1[i]; v2[i] = 0; } sort(v1.begin(), v1.end()); counter = 0; while (1) { flag = 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...
import sys from functools import lru_cache, cmp_to_key from heapq import merge, heapify, heappop, heappush # from math import * from collections import defaultdict as dd, deque, Counter as C from itertools import combinations as comb, permutations as perm from bisect import bisect_left as bl, bisect_right as br, bisect...
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 #input=sys.stdin.buffer.readline t=1 mod=10**9+7 for __ in range(t): #a=[] n=int(input()) #n,m=map(int,input().split()) l=list(map(int,input().split())) l.sort() cnt=0 maxi=0 ans=0 # print(l) while cnt<n: cnt1=0 for i in range(n): if l[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.io.*; import java.util.*; public class CFR2283 { public static void main (String[] args) { Scanner sc = new Scanner (System.in); PrintStream op = System.out; int N = sc.nextInt(); int[] X = new int [N]; int[] pile = new int [N]; for (int i = 0; i < N; i++) X[i] = sc.nextInt(); Arrays.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...
#include <bits/stdc++.h> using namespace std; const double PI = 2.0 * acos(0.0); const double EPS = 1e-9; int cases = 1; double getdist(pair<int, int> a, pair<int, int> b) { return sqrt(pow(a.first - b.first, 2) + pow(a.second - b.second, 2)); } void read(void) { return; } int n, box[105]; int main() { int test; ...
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()) ar=list(map(int,input().strip().split(' '))) ar.sort() i=0 li=list() cnt=[0]*(101) for i in ar: cnt[i]+=1 for i in range(101): if cnt[i]==0: continue if len(li)==00: x=(i+1) li.extend([x]*(cnt[i]//x)) if cnt[i]%x!=0: li.append(cnt[i]%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...
#!/usr/bin/env python import os import sys from io import BytesIO, IOBase #from bisect import bisect_left as bl #c++ lowerbound bl(array,element) #from bisect import bisect_right as br #c++ upperbound br(array,element) def main(): n=int(input()) a=list(map(int,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...
import java.io.*; import java.math.*; import java.util.*; /** * * @author Saju * */ public class Main { private static int dx[] = { 1, 0, -1, 0 }; private static int dy[] = { 0, -1, 0, 1 }; private static final long INF = Long.MAX_VALUE; private static final int INT_INF = Integer.MAX_VALUE; ...
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 MAXN = 100 + 10; int n, a[MAXN], mark[MAXN], l; void input() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); } int main() { input(); int l = 0; bool chek; for (int i = 0; i < n; i++) { chek = true; for (int 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...
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.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream input...
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 x[101]; int towers = 0; int n; cin >> n; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); int count = 0; while (count < n) { int cur = 0; for (int i = 0; i < n; i++) { if (x[i] >= cur) { count++; cur++; ...
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.*; /* @author Mikhail Linkov */ public class TaskC { private final static int MAX = 10000001; public void solve() { InputReader reader = new InputReader(System.in); PrintWriter writer = new PrintWriter(System.out, true); int n = reader.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...
/* Keep solving problems. */ import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; final long MOD = 1000L * 1000L * 1000L + 7; int[] dx = {0, -1, 0, 1}; int[] dy = {1, 0, -1, 0}; void solve() throws IOException ...
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() visited=[0]*n i=0 res=0 while i<n: if visited[i]==0: visited[i]=0 j=i c=0 while j<n: if a[j]>=c and visited[j]==0: visited[j]=1 c += 1 j+=1 res+=1 i += 1 pr...
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[105]; int main() { int n; cin >> n; vector<int> A(n); for (int i = 0; i < n; ++i) cin >> A[i]; sort(A.begin(), A.end()); for (int i = 0; i < n; ++i) { bool flag = false; for (int j = 0; j <= A[i]; ++j) if (piles[j]) { --piles[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 mm[105] = {0}; bool vis[105] = {0}; int main() { int n, ans = 0, m; cin >> n; m = n; for (int i = 0; i < n; i++) { cin >> mm[i]; } sort(mm, mm + n); int we = 0; while (m) { for (int i = 0; i < n; i++) { if (!vis[i] && mm[i] >= we) { ...
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 # sys.stdin = open('input.txt', 'r') # sys.stdout = open('output.txt', 'w') # t=int(input()) t=1 while t: t-=1 n=int(input()) l=list(map(int,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...
import java.io.*; import java.lang.reflect.Array; import java.math.*; import java.text.DecimalFormat; import java.util.*; public class Main { private static int n; private static int [] A; private static boolean can(int m) { int [] R = new int[m]; for (int i = 0;i < m;i++) 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...
def main(): mode="filee" if mode=="file":f=open("test.txt","r") #f.readline() #input() get = lambda :[int(x) for x in (f.readline() if mode=="file" else input()).split()] [n]=get() a=get() a.sort() p=[[]] p[0].append(a[0]) for i in a[1:]: p=sorted(p,key = lambda x:len...
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.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.Scanner; /** * Created by PalmZE on 13.11.2015. */ public class Task388A { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); 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...
n,ans,tot=input(),0,0 a=sorted(map(int, raw_input().split())) taken = [False] * n while tot < n: curr=0 for i in range(n): if (not taken[i]) and a[i] >= curr: taken[i] = True curr += 1 tot += curr 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...
#include <bits/stdc++.h> using namespace std; const int N = 200; int a[N]; bool used[N]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); sort(a, a + n); int cnt = 0; int ans = 0; while (cnt != n) { int st = 0; for (int i = 0; i < n; i++) { if (!used[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() { ios_base::sync_with_stdio(0); int H[101] = {0}; int n, x; cin >> n; for (int i = 0; i < n; i++) cin >> x, H[x]++; int ats = 0; int box = 0; while (box <= 100) { if (H[box] == 0) { box++; continue; } ats++; H[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...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class Main { private static Buffered...
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[110]; multiset<int, greater<int> > s; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &x[i]); sort(x, x + n); for (int i = 0; i < n; i++) { auto y = s.lower_bound(x[i]); if (y == s.end()) { s.insert(1); } else { ...
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()) val = [[]] for x in sorted(int(x) for x in input().split()): for l in val: if x >= len(l): l.append(x) break if len(val[-1]) > 0: val.append([]) print(len(val) - 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 java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class T389C { public void solve(int n, int[] x) { Arrays.sort(x); int cur = 0; int 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...
//https://codeforces.com/problemset/problem/388/A //A. Fox and Box Accumulation import java.util.*; import java.io.*; public class CF_388_A{ public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new Out...
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 maxn = 111; int n, ans; int a[maxn]; bool v[maxn]; void Init() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); } void Work() { sort(a + 1, a + 1 + n); while (1) { int pos = 1; while (v[pos] && pos <= n) pos++; if (pos == 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; const int N = 109; int a[N], c[N]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a + n); reverse(a, a + n); int ans = -1; for (int i = 1; i <= n; ++i) { memset(c, 0, sizeof(c)); for (int j = 0; j < i; ++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...
import java.util.*; public class c228 { public static void main(String ar[]) { Scanner obj=new Scanner(System.in); int n=obj.nextInt(); int a[]=new int[n]; boolean b[]=new boolean[n]; Arrays.fill(b,false); for(int i=0;i<n;i++) a[i]=obj.nextInt(); Arrays.sort(a); int cnt=n; int ret=0; int cur=0; while(cnt>0) { ret+=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 n, x[105], used[105], ans = 0; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); for (int i = 0; i < n; i++) { if (!used[i]) { used[i] = 1; int l = 1; for (int j = i + 1; j < n; j++) { if (!used[j] && 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...
n = int(input()) a = sorted(map(int, input().split()), reverse=True) def ok(cnt): stacks = [[] for _ in range(cnt)] for i, val in enumerate(a): stacks[i % cnt].append(val) for stack in stacks: for i, val in enumerate(stack): if val < len(stack) - i - 1: return Fa...
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[101]; int main() { int i, j, n, ans = 0, size = 0; scanf("%d", &n); int b[n]; for (i = 0; i < n; i++) { scanf("%d", &b[i]); arr[b[i]]++; } for (i = 0; i <= 100; i++) { size = 0; if (arr[i] > 0) { ans++; arr[i]--; size++;...
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.util.Arrays; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Mahmoud Aladdin <aladdin3> */ public class Main { public static void main(String[] args) { InputSt...
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.Scanner; import java.io.OutputStream; import java.io.IOException; import java.util.Arrays; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Himalay(himalayjoriwal@gmail.com) */ public class Main { public static ...
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()))) a = [0] * n ans = 0 for i in range(n): ok = False for j in range(ans): if x[i] >= a[j]: a[j] += 1 ok = True break if ok == False: ans+=1 a[ans - 1] = 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...
n,ans = input(),0 a = map(int,raw_input().split()) h = [(len(filter(lambda x:x <= i,a))+i)/(i+1) for i in range(101)] print max(h)
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 a[110], d[110]; void solve() { int i, j, ans, con, dem; memset(d, 0, sizeof(d)); sort(a, a + n); ans = 0; con = n; while (con) { dem = 0; for (i = 0; i < n; i++) if (d[i] == 0 && a[i] >= dem) { d[i] = 1; dem++; co...
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() { ios_base::sync_with_stdio(false); int n, ans = 0; cin >> n; vector<int> a(n), c(n, 1), p(n, -1); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); while (a.size()) { fill(c.begin(), c.begin() + a.size(), 1); fill(p.begin()...
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 double eps = 1e-9; const int inf = (1 << 30) - 1; const long long inf64 = ((long long)1 << 62) - 1; const long double pi = 3.1415926535897932384626433832795; template <class T> T sqr(T x) { return x * x; } template <class T> T abs(T x) { return x < 0 ? -x : 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.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws Exception{ int n = readInt(); int[] t = new int[n]; for(int i = 0; i < n; i++){ t[i] = readInt(); } Arrays.sort(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...
import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.Scanner; public class round389problemc { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n=in.nextInt(); ArrayList<Integer> a=new ArrayList<Integer>(); 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...
import java.io.*; import java.util.*; public class CodeForces { public void solve() throws IOException { int n = nextInt(); List<Integer> arr = new ArrayList<Integer>(); int res = 0; for (int i = 0; i < n; i++) { arr.add(nextInt()); } Collections.sort(arr); while (arr.size() > 0) { int h = 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 i, j, k, n, ans, used; int main() { cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); while (used < n) { ans++; k = 0; for (i = 0; i < n; i++) if (a[i] >= k) { a[i] = -1; k++; used++; } }...
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()) l=map(int,raw_input().split()) ans=chk=cnt=0 l.sort() while n: if n==chk: chk=0 cnt=0 if cnt==0: ans+=1 l.pop(0) cnt+=1 n-=1 elif cnt<=l[chk]: l.pop(chk) cnt+=1 n-=1 else: chk+=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...
def correct(a): n = len(a) for i in range(n): for j in range(len(a[i])): if (a[i][j] < len(a[i]) - j - 1): return False return True n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) ans = n for i in range(n, 0, -1): cur = [] for j in rang...
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.Scanner; import java.util.TreeMap; public class C228 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] w = new int[101]; for(int i = 0; i < n; i++) w[s.nextInt()]++; int ans = 0; int cov = 0; int r = 100; int l = 0; int t = 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 main() { ios_base::sync_with_stdio(false); long n, i, j, x = 0, ans = 0, term = 0; long a[101]; bool vis[101] = {}; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); while (x < n) { ans++, term = 0; for (i = 0; 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 = input() a = map(int, raw_input().split()) a.sort() p = [1] for x in a[1:]: mini = min(p) if x >= mini: p[p.index(mini)] += 1 else: p.append(1) print len(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...
n = int(input()) ip = input().split(' ') ip2 = sorted(list(map(int, ip))) count = 0 keys = set(ip2) while len(ip2) != 0: stack = [] for x in keys: while (len(stack)<= x and ip2.count(x) > 0): stack.append(x) del[ip2[ip2.index(x)]] count = count + 1 print(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...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.util.TreeMap; public class C { static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); stati...
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 C[101]; int main() { cin >> N; for (int i = 0; i < N; i++) { int x; cin >> x; C[x]++; } int k = 0; while (true) { bool f = false; int c = -1; for (int x = 100; x >= 0; x--) { if (C[x] > 0) { C[x]--; c = 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...
#include <bits/stdc++.h> using namespace std; const int N = 4000009; int main() { int n; cin >> n; int a[111]; int x, ans = 0; int xep[111] = {0}; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { x = 0; if (!xep[i]) { x++; 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...
#include <bits/stdc++.h> using namespace std; int n, a[200]; int dp[200]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); dp[0] = 1; for (int i = 1; i < n; i++) { int ma = -1, v = -1; for (int j = 0; j < i; j++) if (dp[j] <= a[i] && dp[j] > ma) ma = dp[j], v = 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...
import java.io.*; import java.math.BigInteger; import java.util.*; import java.text.*; public class cf389c { static BufferedReader br; static Scanner sc; static PrintWriter out; public static void initA() { try { 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 main() { int n; cin >> n; vector<int> x; int ans = 0; for (int i = 0; i < n; i++) { int t; cin >> t; x.push_back(t); } sort(x.begin(), x.end()); while (!x.empty()) { for (int i = 0; i <= n; i++) { if (lower_bound(x.begin(), x.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...
import java.util.*; public class BruteForce{ public static Scanner in=new Scanner(System.in); public static void main(String[]args){ int n=in.nextInt(); int[]z=new int[n]; for(int i=0;i<n;i++) z[i]=in.nextInt(); Arrays.sort(z); int count=0; int given...
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() piles=[] for x in l: if x==0: piles.append(1) continue f=0 for i in range(len(piles)): if piles[i]<=x: piles[i]+=1 f=1 break if not f: piles.append(1) print(len(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...
from sys import maxint raw_input() box_caps = map(int, raw_input().split(' ')) box_caps.sort(key=lambda x: -x) stacks = [] while len(box_caps) != 0: current_cap = box_caps.pop() # Select for the current element a stack that it can hold with the lowest surplus capacity selected_stack = None min_surplus = maxin...
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...
/***** BY MURAD ******/ /*Everyone has a different way of thinking, so God Created us*/ /*Hope You Respect My Way..,Thank You*/ import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
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.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import...
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> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } sort(v.rbegin(), v.rend()); int ans = n; for (int i = 1; i < n; i++) { vector<vector<int> > piles(i); for (int j = 0; j < n; j++) piles[j % i].push_back(...
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.*; //DONT FORGET TO CHANGE CLASS NAME! public class FoxBox { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); StringTokenizer st=new StringTokenizer(sc.nextLine()); int numBoxes=Integer.parseInt(st.nextToken(...
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[107]; bool cmpr(int a, int b) { return a > b; } int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> x[i]; sort(x, x + n, cmpr); for (int ans = 1; ans <= n; ++ans) { bool ok = true; for (int i = 0; i < ans && ok; ++i) { for (int j = 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.io.*; import java.util.*; public class cf { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(Reader in) { br = new BufferedReader(in); } public FastScanner() { this(new InputStreamReade...
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() { ios::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; vector<long long> vec(n); for (int i = 0; i < n; i++) cin >> vec[i]; sort(vec.begin(), vec.end()); vector<long long> vis(n, 0); long long tot = 0, ans = 0; while (tot < 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...
def solve(a): a.sort() res = 0 n = len(a) while n > 0: r = [] for i, x in enumerate(a): if x == -1: continue if x >= len(r): r.append(x) n -= 1 a[i] = -1 res += 1 return res n = int(raw_input()) x = map(int, raw_input().split()) print solve(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...
#include <bits/stdc++.h> using namespace std; int i, j, k, x, y, z, m, n, ans, p, q, r; int ara[400]; int main() { cin >> n; for (i = 0; i < n; i++) cin >> ara[i]; sort(ara, ara + n); ans = 0; for (i = 0; i < n; i++) { if (ara[i] == -1) continue; x = ara[i]; ara[i] = -1; for (j = i + 1, x = 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; const int maxn = 1e2 + 10; int dp[maxn]; int n; int a[maxn]; int mp[maxn]; int mo[maxn]; int v(int u) { int res = 0; for (int i = u; i < maxn; i++) { res += mo[i]; } return res; } void of(int k, int f) { for (int i = k; i < maxn && f > 0; i++) { if (mo[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.io.*; import java.util.*; import static java.lang.Math.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] data = 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...
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; long long a[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); vector<long long int> v; v.push_back(0); for (long long int i = 0; i < n; i++) { long long j = 0; while (1) { if (j == (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...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5, mod = 1e9 + 7; multiset<int> q, v; int n, a[maxn], cnt, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); int cur = 1; while (cur <= 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...
# coding: utf-8 n = int(input()) ans = 0 li1 = [int(i) for i in input().split()] li2 = [] while li1: li1.sort() n = len(li1) i = 0 while i < n: if li1[i] < i: li2.append(li1[i]) del(li1[i]) n -= 1 else: i += 1 ans += 1 li1 = li2 ...
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[101]; bool b[101]; int main() { int n, i, j, nrb, rasp = 0; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); for (i = 1; i <= n; i++) if (b[i] == 0) { nrb = 1; b[i] = 1; j = i + 1; while (j <= n) { f...
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.Scanner; public class C { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int a[] = new int[500]; for(int i=0;i<n;i++){ int b = in.nextInt(); a[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...
#include <bits/stdc++.h> using namespace std; const int maxn = 111; int a[maxn]; int b[maxn]; int main() { int n; while (~scanf("%d", &n)) { memset(b, 0, sizeof(b)); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); b[a[i]]++; } sort(a, a + n); int x = a[n - 1]; int t = n; 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=input() a=map(int,raw_input().split()) a.sort() p=[0]*n c=0 for i in a: for j in range(n): if p[j]<=i: p[j]+=1 c=max(c,j) break print 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...
#include <bits/stdc++.h> using namespace std; int a[101]; int used[101]; int p = 0; int main() { int n; scanf("%d", &n); int i, j; for (i = 1; i <= n; i++) { scanf("%d", &a[i]); } sort(a + 1, a + 1 + n); for (i = 1; i <= n; i++) { if (used[i] == 0) { int t = 1; p++; used[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...
//package codeforces; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class FoxandBoxAccumulation { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int N = in.nextIn...
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 n, m, a[2000], s, k, l, i, j, b[2000], p; int main() { cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); while (p == 0) { p = 1; l = 0; for (i = 1; i <= n; i++) if (l <= a[i] && b[i] == 0) { l++; b[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; inline int init() { int now = 0, ju = 1; char c; bool flag = false; while (1) { c = getchar(); if (c == '-') ju = -1; else if (c >= '0' && c <= '9') { now = now * 10 + c - '0'; flag = true; } else if (flag) return now * ju; ...
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; void solve(); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int test = 1; while (test--) { solve(); } return 0; } void solve() { int n; cin >> n; multiset<int> st; for (int i = 0; i < n; i++) { int x; cin >> x; st....
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...
num = int(input()) boxes = list(map(int, input().split())) boxes.sort(reverse=True) piles = [] while boxes: box = boxes.pop() for pile in piles: if box >= len(pile): pile.append(box) break else: piles.append([box]) print(len(piles)) # 1536683664960
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 inFile = stdin tokens = [] tokens_next = 0 def next_str(): global tokens, tokens_next while tokens_next >= len(tokens): tokens = inFile.readline().split() tokens_next = 0 tokens_next += 1 return tokens[tokens_next - 1] def nextInt(): return int(next_str()) de...
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() X=sorted(map(int,raw_input().split())) r=0 while X: r+=1;X=X[1:];t=0 while 1: l=[i for i in X if i>t] if[]==l:break X.remove(l[0]);t+=1 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...
import java.io.*; import java.util.*; public class FoxAndBoxAccumulation { public static void main(String[] args){ int n = ni(); int[] a = na(n); Arrays.sort(a); int i, group = 0, count; for(i=0; i<n; i++){ if(a[i]!=-1){ group++; count = 1; for(int j=i+1; j<n; j++){ if(a[j]!=-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 java.io.*; import java.util.*; public class problem389C { public static void main (String[]args)throws IOException{ BufferedReader x = new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(x.readLine()); StringTokenizer st=new StringTokenizer(x.readLine()); int[]values=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.io.*; import java.util.*; public class FoxAndBoxAccumulation { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); int n, ind, t; int[] boxes; ArrayList<LinkedList<Integer>>...
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 import collections case = int(sys.stdin.readline()); test = sys.stdin.readline().split(" "); num = [int(x) for x in test] stats = collections.defaultdict(int); for i in num: stats[i]+=1; key = sorted(stats) total = 0; while sum(stats.values())>0: stack = []; for i in key: if(stats[i]>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 java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...