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.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; /* spar5h */ public class cf1 implements Runnable{ public void run() { InputReader s = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = s.nextInt(); 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 java.io.*; import java.util.*; public class BoxAccumulation { public static void main(String[]args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int [] arr = new int[n]; 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 static java.lang.Math.*; import static java.util.Arrays.*; public class A { private final static boolean autoflush = false; public A () { int N = sc.nextInt(); Integer [] A = sc.nextInts(); int [] K = new int [101]; for (int i : A) ++K[i]; int p = 0, q = N, m; while (q - p > 1) if (eval(...
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[105]; while (~scanf("%d", &n)) { for (int i = 1; i <= n; i++) { scanf("%d", &x[i]); } sort(x + 1, x + 1 + n); int ans = 0, num, j; for (int i = 1; i <= n; i++) { if (x[i] != -1) { ans++; x[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...
input();print(1+max(x//-~f for x,f in enumerate(sorted(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...
I=lambda:list(map(int,input().split())) n,=I() l=I() l.sort() ans=0 i=0 k=1 while i<n: if l[i]<i//k: k+=1 i+=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...
def take_lightest_box(boxes): for i in range(101): if i in boxes: boxes[i] -= 1 if boxes[i] == 0: del boxes[i] return i piles = [] boxes = {} input() tmp = input() x = [int(i) for i in tmp.split(" ")] for item in x: if item in boxes: bo...
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 M = 1000000007; const int N = 2e6; void solve() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int cnt = 0; long long ans = 0; while (cnt < n) { ans++; int h = 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...
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author rabeckiy */ public class Main { public static void main(String[] args) { InputStream inputStream ...
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); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; sort(a.begin(), a.end()); vector<int> v; for (int i = 0; i < n; ++i) { int val = a[i], idx = -1; for (...
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; const long long INFL = LLONG_MAX; const long double pi = acos(-1); int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int main() { ios_base::sync_with_stdio(0); cout.precision(15); cout << fixed; cout.tie(0); cin.tie(0); int n; 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...
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...
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.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; public class june { static Reader r = new Reader(); static PrintWriter out = new PrintWriter(System.out); private static void solve1() throws ...
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 = 0x3f3f3f3f; int a[102]; int n; int cnt = 0; int cou[101]; int main() { scanf("%d", &n); int x; memset(a, inf, sizeof(a)); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); } sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i++) { int bl...
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() { long long t; cin >> t; long long a[t]; for (int i = 0; i < t; i++) cin >> a[i]; sort(a, a + t); long long c = 0, i; for (i = 0; i < t; i++) { if (c * (a[i] + 1) <= i) c++; } cout << c; return 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 a[110]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int ret; cin >> ret; a[ret]++; } int res = 0; for (;;) { int k = -1; for (int i = 0; i <= 100; i++) if (a[i]) { k = i; break; } if (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...
def validate_stack(stack): for i in range(len(stack)): if stack[i] < len(stack)-i-1: return False return True # print(validate_stack([4,4,4,4,4])) if __name__ == '__main__': n = int(input()) box_strength = [int(x) for x in input().split()] box_strength = sorted(box_strength, reverse = True) flag = True 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.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.util.StringTokenizer; public class FoxAndBoxAccumulation { public static void main(String[] args) { MyScanner sc = new MyScanner(); int N = sc.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...
n,p=int(input()),0 a=sorted(map(int,input().split())) for i in range(n): if p*(a[i]+1)<=i:p+=1 print(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.util.*; import java.util.Scanner; import java.io.*; import javax.lang.model.util.ElementScanner6; import static java.lang.System.out; import java.util.Stack; import java.util.Queue; import java.util.LinkedList; public class A388 { public static void main(String args[]) { FastR...
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.sort() ans=0 while len(l): s=[] b=0 for i in range(len(l)): if b<=l[i]: b=b+1 # print(l[i],end=" ") else: s.append(l[i]) ans=ans+bool(b) l=s 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; int n; vector<int> v(100); bool a[100] = {0}; int ans = 0; int main() { std::ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.begin() + n); for (int i = 0; i < n; i++) { if (a[i]) continue; int mx = 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...
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time import sys, io import re, math #start = time.clock() n=input() l=[int(x) for x in raw_input().split()] l.sort() chk=l[:] ans=[] jk=0 while len(l): l=chk[:] ans.append([]) for i in range(len(l)): if i==0: ans[jk].append(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 sys if __name__ == '__main__': _ = sys.stdin.readline().split() boxes = map(int, sys.stdin.readline().split()) boxes = sorted(boxes) piles = [] for b in boxes: put = False for p in piles: if len(p) <= b: p.append(b) put = 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; const int N = 105; int n; int sz[N], len; int cnt[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { int x; scanf("%d", &x); ++cnt[x]; } len = cnt[0]; for (int i = 1; i <= len; ++i) sz[i] = 1; for (int i = 1; i <= 100; ++i) { for (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 main(): n = int(input()) strength = list(map(int,input().split())) strengths = {} for i in strength: if i not in strengths.keys(): strengths[i] = 1 else: strengths[i] += 1 boxes = [] for i in strengths.keys(): boxes.append([i,strengths[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, a[105], j, i, count = 0, res = 1, idx = 0; cin >> n; int b[105] = {0}; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 1; i < n; i++) { if (i / res > a[i]) res++; } cout << res << endl; return 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...
n=int(input()) listn=list(map(int, input().split())) listn=sorted(listn) i=0 res=0 vis=[] while i<n: res+=1 currPile=[] k=0 while k<n: if listn[k]>=len(currPile) and not k in vis: i+=1; vis.append(k); currPile.append(1) k+=1 print(res)
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 in = new Scanner(System.in); int n = in.nextInt(); int[] strength = new int[n]; boolean[] used = new boolean[n]; for(int i = 0; i < n; i++) { strength[i] = in.nextInt(); } Arrays.sort(strength); int piles = 0; 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[101]; for (int i = 0; i < n; i++) A[in.nextInt()]++; int last = A[0]; int size = A[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 a[101]; int main() { int n, i, j; cin >> n; for (i = 0; i < n; i++) { cin >> j; a[j]++; } int numbox = 0, piles = 0, flag; while (1) { numbox = 0; flag = 0; for (i = 0; i <= 100; i++) { if (a[i] > 0 && numbox <= i) { flag = ...
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, j, k, m, l, f, y; char ch; vector<vector<int>> v; vector<int> p; cin >> n; vector<int> q(n + 2, 0); for (int i = 0; i < n; i++) { v.push_back(q); } for (int i = 0; i < n; i++) { cin >> k; p.push_back(k); } sort(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...
n=input() no=map(int,raw_input().split()) no.sort() ans=[[no[0]]] for i in xrange(1,n): f=0 for j in xrange(len(ans)): if len(ans[j])<=no[i]: ans[j].append(no[i]) f=1 break if f==0: ans.append([no[i]]) print len(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...
""" // Author : snape_here - Susanta Mukherjee """ from __future__ import division, print_function import os,sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def ii(): return int(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...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class ForcesC { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
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 = [*map(int,input().split())] l.sort() spen = 0 ans = 0 while(spen < n): x = 0 for i in range(n): if(l[i] >= x): x += 1 spen += 1 l[i] = -10**3 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.util.*; public class A { public static void main(String... args) { final Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); final int[] x = new int[n]; for (int i = 0; i < n; i++) x[i] = sc.nextInt(); Arrays.sort(x); int ans = 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 a[105], h[105], n; int sum = 1; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); sort(a + 1, a + n + 1); h[1] = 1; for (int i = 2; i <= n; ++i) { sort(h + 1, h + sum + 1); if (a[i] < h[1]) { ++sum; h[sum] = 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.BufferedInputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public Scanner cin=new Scanner(new BufferedInputStream(System.in)); public int n; public int a[] = new int[200]; public int b[] = new int[200]; public ...
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{ public static void main(String args[]) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int ar[] = new int[n]; int pred[] = new int[n]; int 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...
#include <bits/stdc++.h> using namespace std; int exists[11111]; vector<int> v; int N, i, j; int main() { scanf("%d", &N); v.resize(N); for (i = 0; i < N; i++) scanf("%d", &(v[i])); sort(v.begin(), v.end()); exists[1] = 1; for (i = 1; i < N; i++) { for (j = v[i]; j >= 1; j--) if (exists[j] > 0) br...
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(1+max(x//-~f for x,f in enumerate(sorted(map(int,input().split()))))) # Made By Mostafa_Khaled
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 dx[4] = {-1, 0, 1, 0}; const long long dy[4] = {0, -1, 0, 1}; const long long dxx[] = {1, 1, 0, -1, -1, -1, 0, 1}; const long long dyy[] = {0, 1, 1, 1, 0, -1, -1, -1}; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(...
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 import sys input = sys.stdin.readline for _ in range(1): n=int(input()) arr=[int(x) for x in input().split()] arr.sort() temp=[] for i in arr: f=False #print(temp) for k in range(len(temp)): if temp[k]<=i and i!=0: f=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...
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.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java...
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 is_possible(vector<int> &strength, int no_of_piles) { priority_queue<int> pile_tops; int box_ptr = strength.size() - 1; for (int i = 1; i <= no_of_piles; i++) pile_tops.push(strength[box_ptr--]); while (box_ptr >= 0) { int strongest_pile = pile_tops.top(); ...
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 A { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); int[] arr = in.readArray(n); Arrays.sort(arr); boolean[] used = new boolean[n]; int ans = 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 mop[100000]; void chek(string str) { for (int i = 0; i < str.size() / 2; i++) { if (str[i] != str[str.size() - 1 - i]) mop[i] = 1, mop[str.size() - 1 - i] = 1; } } int ch(string str) { for (int i = 0; i < str.size() / 2; i++) { if (str[i] != str[str....
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 MAX = 100 + 10; const int inf = 0x3f3f3f3f; int num[MAX], use[MAX]; int main() { int n, ans, ret; while (scanf("%d", &n) > 0) { ans = 0; int tot = 0; for (int i = 0; i < n; i++) scanf("%d", &num[i]); sort(num, num + n); memset(use, 0, sizeo...
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[101]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int ans = 0, h, used = 0; while (used < n) { ans++; h = 0; for (int i = 0; i < n; i++) { if (a[i] != -1 && a[i] >= h) { 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 main() { int n, i, t, piles = 1; bool flag = true; cin >> n; vector<int> s1, s2; vector<int>::iterator it; for (i = 0; i < n; i++) { cin >> t; s1.push_back(t); } sort(s1.begin(), s1.end()); while (flag) { flag = false; for (it = s1.begi...
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; scanf("%d", &n); int ar[1000]; for (int i = 0; i < n; i++) scanf("%d", &ar[i]); sort(ar, ar + n); deque<int> q; for (int i = 0; i < n; i++) q.push_back(ar[i]); int ans = 0; while (!q.empty()) { ans++; int tp = 0; int pos = 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...
#/usr/bin/env python2 n = int(raw_input()) arr = [int(x) for x in raw_input().split(" ")] arr.sort() r = [] for x in arr: if x == 0: r.append(1) continue f = False for i in xrange(len(r)): if r[i] <= x: r[i] = r[i]+1 f = True break if not f: r.append(1) print len(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; long long MOD = 1e9 + 7; std::vector<long long> se(std::vector<long long> v) { std::vector<long long> v1; for (long long i = 0; i < v.size(); ++i) { if (v1.empty() || v1.back() != v[i]) { v1.push_back(v[i]); } } return v1; } void prinvector(std::vector...
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.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; public class Main { static final Random random = new Random(); static 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...
#include <bits/stdc++.h> using namespace std; int n, t[102]; bool ok(int a) { vector<int> b(a + 1, 1000); for (int i = 0; i < n; i++) { if (!b[i % a]) return 0; b[i % a] = min(b[i % a] - 1, t[i]); } return 1; } int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &t[i]); sort(t, 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.*; public class FoxAndBoxAccumulation { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); List<Integer> box = new ArrayList<Integer>(); for (int i = 0; i < n; i++) { box.add(in.nextInt()); } Collections.sort(box); 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...
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.util.Arrays; /** * Built using CHelper plug-in * Actual solution is at the top * */ public ...
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:16777216") #pragma warning(disable : 4786) using namespace std; template <class T> inline T MAX(T a, T b) { return a > b ? a : b; } template <class T> inline T MIN(T a, T b) { return a < b ? a : b; } template <class T> inline void SWAP(T &a, T &b) { a = 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...
import java.util.*; public class FoxAndBoxAccumulation { Scanner in; int n; List<Integer> list = new ArrayList<Integer>(101); int[] nr = new int[101]; int count=0; public static void main(String[] args) { new FoxAndBoxAccumulation(); } public FoxAndBoxAccumulation() { int number; boolean put; ...
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(NULL); int n, i, j, flag; cin >> n; int arr[100], a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); arr[0] = 1; int c = 1; for (i = 1; i < n; i++) { flag = 0; for (j = 0; j < c; 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...
n = input() m = sorted(map(int, raw_input().strip().split())) kor = [0] for i in xrange(n): if m[i]<min(kor): kor+=[1] else: kor[kor.index(min(kor))]+=1 print len(kor)
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 check { static boolean DEBUG_FLAG = false; int INF = (int)1e9; long MOD = 1000000007; static void debug(String s) { if(DEBUG_FLAG) { System.out.print(s); } } void solve(InputReader in, PrintWriter 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...
n = int(input()) temparr = input() temparr = temparr.split() arr = [] for i in temparr: arr.append(int(i)) arr = sorted(arr) revarr = arr[::-1] mins = len(arr) left = 0 right = mins #print(revarr) while left <= right: temp = [] flag = 0 mid = (left + right ) // 2 nexts = 0 index = 0 for ...
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]; int b[110][110]; vector<int> p[10010]; int main() { for (int i = 0; i < 10010; i++) p[i].clear(); scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) p[i].push_back(a[i]); for ...
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() { long n; while (cin >> n) { long i, ar[2001] = {0}, a, mx = 0, res = 0, f = 0, col[2001] = {0}, flag = 1; for (int i = 0, _n = n; i < _n; i++) cin >> ar[i]; sort(ar, ar + n); while (1) { f = 0; mx = 0; for (int 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 collections import defaultdict, Counter from math import sin, cos, asin, acos, tan, atan, pi sys.setrecursionlimit(10 ** 6) def pyes_no(condition, yes = "YES", no = "NO", none = "-1") : if condition == None: print (none) elif condition : print (yes) else : print (no) def plist(a, 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...
#include <bits/stdc++.h> using namespace std; int n, a[105], l, r, mid, ans; bool ok; int main() { ios::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); l = 1; r = n; while (l <= r) { mid = (l + r) / 2; ok = true; for (int 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...
import java.io.*; import java.util.*; public class Main {public static void main(String[] args) throws Exception { new Solve(); }} class Solve { public Solve() throws Exception {solve(); } static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new 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> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization("unroll-loops") using namespace std; const int maxn = (long long int)1e9 + 7; const double pi = acos(-1.0); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; 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...
def b(a, la, n): for i in range(n): b = a[i::n] ll = (la - i + n - 1) // n for j in range(ll): if b[j] < ll - j - 1: return False return True n = int(input()) a = list(map(int, input().split())) a.sort(reverse = True) l, r = 1, n if b(a, n, l): print(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...
import java.io.*; import java.util.*; public class div2_228_C implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Th...
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 C1 { public static LinkedList<Integer> nums; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(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; template <class T> void findMax(T &m, T x) { m = m > x ? m : x; } template <class T> void findMin(T &m, T x) { m = m < x ? m : x; } const double pi = acos(-1); int main() { unsigned int n, i, j; scanf("%d", &n); int a[n]; for (i = 0; i < n; i++) scanf("%d", 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...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); (new Solver()).solve(in, System.out); } } class Solver { public void solve(Scanner in, PrintStream out) { int n = in.nextInt(); int[] x = new int[n]; in.nex...
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 = 0x3f3f3f3f; #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2") bool comp(int x, int y) { return x > y; } int32_t main() { int n; cin >> n; vector<vector<int> > a; a.resize(1); for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (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() { long long int n, i, j; cin >> n; long long int arr[n]; multiset<long long int> s; map<long long int, long long int> ans; for (i = 0; i < n; i++) { cin >> arr[i]; s.insert(arr[i]); ans[arr[i]]++; } long long int ans2 = 0; while (s.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...
#include <bits/stdc++.h> using namespace std; int n, num[200], tot; int max(int a, int b) { return a > b ? a : b; } int main() { scanf("%d", &n); tot = n; for (int i = 1; i <= n; i++) { int x; scanf("%d", &x); num[x] += 1; } int zu = 0; for (int i = 0; i <= 100; i++) { while (num[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()) a = list(map(int, input().split())) a.sort() k = 1 while True: for i in range(len(a)): if a[i] < (i//k): break else: print(k) break k += 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.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] t = new int[101]; for (int i = 0; i < n; i++) { t[sc.nextInt()]++; } int currStep = 1; while (currStep <= 100) { if (currStep == 0) currStep++; ...
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 A388 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; ++i) { arr[i] = in.nextInt(); } Arra...
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 # n = int(input()) # arr = list(map(int, input().split())) # arr = sorted(arr, reverse=True) # i = 0 # c = 0 # while i < n - 1: # s = sum(arr[i + 1:]) # j = n - 1 # while s >= arr[i]: # print(i, j) # s -= arr[j] # j -= 1 # 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...
#include <bits/stdc++.h> using namespace std; bool vis[101]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int x[n]; for (int i = 0; i < n; i++) cin >> x[i]; sort(x, x + n); memset(vis, 0, sizeof(vis)); int ans = 0; for (int i = 0; i < n; i++) { if (!vis[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.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static void main(String[] args) throws IOException { (new Main()).solve(); } public Main() { } MyReader in = new MyReader(); PrintWriter out = new PrintWriter(System.out); void solve(...
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().split())) ar.sort() a = 1 b = 100 while a < b: compliant = True k = (a+b) // 2 for i in range(len(ar)): if ar[i] < (i//k): compliant = False break if compliant: b = k else: a = k + 1 print(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...
import java.util.*; import java.math.*; import java.io.*; import java.awt.Point; import static java.util.Arrays.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.Short.*; import static java.lang.Math.*; import static java.math.BigInteger.*; ...
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)1e9; const long long llinf = (long long)3e18; const int N = (int)1e5 + 111; const long double PI = (long double)acos(-1); int main() { int n, cur, num, ans = 0; scanf("%d", &n); vector<int> a(n); vector<char> us(n, 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...
#include <bits/stdc++.h> using namespace std; int A[110], n, ans; int main() { cin >> n; for (int i = 0, x; i < n; ++i) cin >> x, A[x]++; int nn = n; while (nn) { int all(0); for (int i = 0; i <= 100; i++) { if (A[i]) { while (A[i] && all <= i) { all++; 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...
//package main; import java.io.*; import java.util.*; import java.awt.Point; import java.math.BigInteger; public final class Main { BufferedReader br; StringTokenizer stk; public static void main(String[] args) throws Exception { new Main().run(); } { stk = null; br =...
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[100], b[100], p = 0; bool piled; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf(" %d", &a[i]); sort(a, a + n); for (int i = 0; i < n; i++) { piled = false; for (int j = 0; j < p; j++) { if (b[j] <= a[i]) { piled = 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...
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author kara...
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 PC { int n; int A[]; int used[]; public static void main(String[] args){ new PC().go(); } private void go(){ Scanner in = new Scanner(System.in); int n = in.nextInt(); A = new int[n]; used = new int[n]; for (int i=0;i<n;i++){ 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...
# your code goes here n=input() A=sorted(map(int,raw_input().split())) 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...
#include <bits/stdc++.h> using namespace std; const int N = 1e2 + 5; int a[N]; multiset<int> st; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } sort(a + 1, a + n + 1); int res = 0; for (int 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=int(input()) arr=[int(x) for x in input().split()] arr.sort() ans=[] for ele in arr: for i in range(len(ans)): if(ans[i]<=ele): ans[i]+=1 break else: ans.append(1) print(len(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 fa[105], cnt[105]; int findset(int x) { if (fa[x] == x) return x; else return fa[x] = findset(fa[x]); } void unionset(int x, int y) { int fx = findset(x), fy = findset(y); if (fx != fy) { fa[fy] = fx; cnt[fx] += cnt[fy]; } } int main() { 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...
#include <bits/stdc++.h> using namespace std; int arr[101]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); int piles = 0, k = 0; while (k < n) { int j = 0; for (int i = 0; i < n; i++) { if (arr[i] >= j) { j++; arr[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 di[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dj[] = {1, -1, 0, 0, 1, -1, 1, -1}; int arr[105]; int getNxt(int a) { for (int i = a; i <= 100; i++) if (arr[i]) return i; return -1; } void form() { int nxt = getNxt(0), len = 0; while (nxt != -1) { len++; 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...
from math import ceil n = int(input()) xs = list(map(int, input().split())) ret = 1 xs.sort() for i in range(n): ret = max(ret, int(ceil((i+1)/(xs[i]+1)))) print(ret)
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 collections import Counter def check(arr): l=len(arr) for i in range(len(arr)): if l-i-1>arr[i]: return False return True def boredom(arr): arr=sorted(arr,reverse=True) for ans in range(1,len(arr)+1): d={} ind=0 for i in arr: d[ind]=d.get...