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 static java.lang.Math.*; import static java.util.Arrays.*; import static java.lang.System.out; import static java.util.Collections.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static boolean LOCAL = System.getSecurityManager() == null; Scanner in = new Scanner(System.in); ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n, a[101]; void scan() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); sort(a, a + n); } void out() { int ans = 0, k = 0, c; while (1) { c = 0; for (int i = 0; i < n; i++) { if (a[i] != -1) { if (a[i] >= k) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, sum, p[110], q[110]; while (cin >> n) { sum = 0; for (i = 0; i < n; i++) cin >> p[i]; sort(p, p + n); memset(q, 0, sizeof(q)); for (i = 0; i < n; i++) if (!q[i]) { sum++; int ans = 0; for (j = 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.*; import java.util.*; public class A { public void solve() { int n = in.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = in.nextInt(); } Arrays.sort(x); List<Integer> curW = new ArrayList<>(); for (int i = 0; i < n; i++) { int min = Integer.MAX_VALUE; fo...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 n; cin >> n; map<int, int> m; for (int i = 0; i < n; i++) { int x; cin >> x; m[x]++; } int cnt = 0; while (!m.empty()) { cnt++; int tmp = 1; int val = m.begin()->first; m[val]--; if (m[val] == 0) m.erase(val);...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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() h = [0] A = list(map(int, input().split())) A.sort() for x in A: if x < min(h): h += [1] else: h[h.index(min(h))]+=1 print(len(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; template <class T> inline bool read(T &x) { int c = getchar(); int sgn = 1; while (~c && c<'0' | c> '9') { if (c == '-') sgn = -1; c = getchar(); } for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0'; x *= sgn; return ~c; } stru...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int box[101]; for (int i = 0; i < n; i++) cin >> box[i]; sort(box, box + n); bool used[101]; memset(used, false, sizeof(used)); int ai = 0, count = 0, piles = 0; for (int i = 0; i < n; i++) { if (!used[i]) { ai = 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...
#include <bits/stdc++.h> using namespace std; int arr[2000], cap[2000]; int main() { int a, b, c, i, j, k, n, m; while (scanf("%d", &n) != EOF) { for (i = 0; i < n; i++) scanf("%d", &arr[i]); sort(arr, arr + n); for (i = 0; i < n; i++) cap[i] = 0; m = 0; for (i = 0; i < n; i++) { for (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...
def main(inp): n = int(inp()) arr = split_inp_int(inp) c = Counter(arr) num_of_pile = 0 box_built = 0 while box_built < n: current_height = 0 for i in range(101): while i >= current_height and i in c and c[i] > 0: c[i] -= 1 box_built +=...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); } int in[110]; int used[110]; int main() { int n; while (cin >> n) { fill_n(used, n, 0); for (int(i) = (0); (i) < (n); ++(i)) { scanf("%d", in + i)...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n, a[101]; bool vis[101]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + n + 1); int ans = 0; for (int i = 1; i <= n; i++) if (!vis[i]) { ans++; int now = 1; vis[i] = 1; 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...
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); int ans = 1; int height; for (int i = 1; i < n; i++) { height = i / ans; while (arr[i] < height) ans++, height = i / ans; } cou...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 bisect n = int(input()) xi = list(sorted(map(int, input().split()))) s = set(xi) li = [] while len(xi) > 0: li.append([xi.pop(0)]) i = 0 while i < len(xi): if xi[i] >= len(li[-1]): li[-1].append(xi.pop(i)) else: i += 1 # print(li) print(len(li))
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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); int n, t; int[] boxes; ArrayList<LinkedList<Integer>> piles = new 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...
n=int(input()) l=sorted(list(map(int,input().split()))) piles=[None]*100 for i in range(1,100): piles[i]=[] piles[0]=[l[0]] i=1 for j in range(1,n): flag=0 for k in range(0,i): if l[j] >= len(piles[k]): piles[k].append(l[j]) flag=1 break if flag==0: pi...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
input();x=sorted(map(int,input().split()));print(max([((ind+1)//(i+1)+((ind+1)%(i+1)!=0)) for ind,i in enumerate(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...
n = int(input()) a = list(map(int, input().split())) a.sort() counter = 0 while len(a) != 0: numbers = {-1} for elements in a: numbers.add(elements) numbers.remove(-1) for values in numbers: a.remove(values) j = 0 s = 0 for values in numbers: if len(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...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Solution { 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...
#include <bits/stdc++.h> using namespace std; struct pairvar { int a; int b; int c; int max; }; bool isPrime(long long x) { if (x == 1) { return false; } long long a = (long long)x; for (int i = 2; i <= (long long)sqrt((double)a); i++) { if (a % i == 0) { return false; } } return t...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; long long n, m, x, y, z, k, sol, sum, ans, l, r, xx, yy, a[1000000], b[1000000]; vector<long long> v; vector<long long> v1; vector<pair<long long, long long>> v2; pair<long long, pair<long long, long long>> pp[1000000]; pair<long long, long long> p[1000000]; map<long long, ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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]; int cnt[105]; int find(int x) { for (int i = x - 1; i >= 0; i--) if (cnt[i]) return i; return -1; } int main() { int n; memset(cnt, 0, sizeof cnt); scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); cnt[a[i]]++; } boo...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 solve2() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); ; vector<bool> use(n, false); int lo = 0; int ans = 0; while (lo < n) { ans++; int top = 0; for (int i = 0; i < n;...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import math def ok(pile): for i in range(len(pile)): if(len(pile) - i-1 > pile[i]): return False return True def solve(sbox, p): ap = []; for i in range(p): pile = [sbox[0]] sbox.pop(0); ap.append(pile); currentPile = 0; full = [False]*p while 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...
from sys import stdin inp = [l.split() for l in stdin.readlines()] p = [int(a) for a in inp[1]] p = sorted(p) s = [0]*(len(p)+5) #print [i for i in p] for i in range(len(p)): for j in range(len(p)): if p[i] >= s[j]: s[j] +=1 break print s.index(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.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.Comparator; impor...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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[100 + 10]; bool used[100 + 10]; map<int, int> cc; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int rs = 0; for (int i = 0; i < n; i++) { if (used[i]) continue; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.System.in; import static java.lang.System.out; import java.io.*; import java.util.*; public class Main { static final double EPS = 1e-10; static final double INF = 1 << 31; static final double PI = Math.PI; public static Scanner sc = new Scanner(in); StringBuilder sb = new StringBuilder(...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.StringTokenizer; /** * @author Don Li */ public class FoxBoxAccumulation { void solve() { int n = in.nextInt(); int[] x = new int[n]; for (int i = 0; i...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { int n, t; while (scanf("%d", &n) == 1) { int a[105]; bool vis[105] = {false}; memset(a, 0, sizeof(a)); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } sort(a, a + n); int ans = 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...
//http://codeforces.com/contest/389/problem/C import java.util.*; public class FoxBox { /* * find top box, find smallest box that can go below that, keep going until 1 stack is done * recurse on remaining list of boxes */ public static void magic(ArrayList<Integer> v, int c) { if (v.size() == 0) { Syst...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.Arrays; import java.util.Scanner; public class C228 { /** * @param args */ 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; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 = 1e5 + 5; int n, ans; multiset<int> setik; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; setik.insert(x); } while (setik.size()) { int cur = 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> int comp(const void* a, const void* b) { return *(int*)a - *(int*)b; } int main() { int n, i, j, t, count, p; int s[105]; while (scanf("%d", &n) != EOF) { t = n; for (i = 0; i < n; i++) scanf("%d", &s[i]); qsort(s, n, sizeof(int), comp); while (t) { for (i = 0, p = 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() { int ans = 0; int n, tmp; bool vis[106]; int a[106]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); vis[i] = true; } sort(a, a + n); for (int i = 0; i < n; i++) { if (vis[i]) { ans++; tmp = 1; 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...
#include <bits/stdc++.h> using namespace std; int main() { int a[105] = {0}; int n; ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; int temp, mx = 0; for (int i = 0; i < n; ++i) { cin >> temp; a[temp]++; mx = max(mx, temp); } for (int i = 1; i < mx + 1; ++i) a[i] += a[i - 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...
n = int(input()) a = [int(x) for x in input().split()] v = [True]*n a.sort() ans = 0 prev = 0 i = 0 cnt = 0 while(cnt<n): if a[i]>=prev and v[i]: cnt += 1 v[i] = False prev += 1 i += 1 if i==n: i = 0 prev = 0 ans += 1 if prev != 0: 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; int box_strength[111], piles[111]; int main() { int num, i, j; cin >> num; for (i = 0; i <= num - 1; i++) cin >> box_strength[i]; sort(box_strength, box_strength + num); int pile_index = 0, min = INT_MAX, min_index; for (i = 0; i <= num - 1; i++) { min = 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.util.*; //Scanner; import java.io.PrintWriter; //PrintWriter public class R228_Div2_C { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); solve(in, out); out.close(); in.close(); } public static void solve(Scann...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
/** * Created with IntelliJ IDEA. * User: den * Date: 2/3/14 * Time: 6:12 PM * To change this template use File | Settings | File Templates. */ import java.io.*; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class TaskC extends Thread { public static int an...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; import jav...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class C228 { public void run() throws NumberFormatException, IOException { BufferedReader bReader = ne...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> list = new LinkedList<>(); 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() { int n, strength[104], count = 0; bool strikeoff[104]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &strength[i]); strikeoff[i] = false; } sort(strength, strength + n); int weight = 0, start_at = 0; bool start_set = 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 maxn = 1e2 + 5; int a[maxn]; int bo[maxn]; int fin[105]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; bo[a[i]]++; } sort(a + 1, a + n + 1); int maxx = 1; int i = 0; while (n) { int k = 1; while (bo[a[i]]...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, a[105]; vector<int> v; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n; i++) { int j; for (j = 0; j < (int)v.size(); j++) { if (v[j] <= a[i])...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int maxn = 110; int n; int s[maxn]; bool used[maxn]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &s[i]); sort(s, s + n); for (int i = 0; i < n; i++) used[i] = false; int cnt = 0; for (int i = 0; i < n; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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> int n, MaxStr, i, x, f[105], ans; int max(int a, int b) { return a > b ? a : b; } void solve(int str, int now) { if (str > MaxStr) return; if ((now > str) || (!f[str])) solve(str + 1, now); else { f[str]--; solve(str, now + 1); } } int main() { scanf("%d", &n); memset(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.*; import java.io.*; public class Fox_And_Fox_Accumulation { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int x[] = new int[n]; boolean taken[] = new boolean[n]; for(int i = 0; i < n; i++) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
""" greedy alg properties : len(stack) < x[i], if not, new stack """ number_of_items = int(raw_input()) items_strength = map(int, raw_input().split(" ")) items_strength.sort() stacks = [] new_stack = [] stacks.append(new_stack) for item in items_strength: flag = True for stack in stacks: if len(stack) <= item:...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; public class CF { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); PrintWriter out = new PrintWriter(Sy...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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() arr = map(int,raw_input().split()) arr.sort() # arr=arr[::-1] piles=[0]*101 s=0 c=0 pile=[1] for i in arr[1:]: # print i f=False for j in range(len(pile)): if pile[j]<=i: pile[j]+=1 f=True break if f==False: pile.append(1) pile.sort() ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import sys n=int(raw_input()) ar=map(int,raw_input().split()) ar.sort() p=0 c_ar=ar[::] while ar!=[]: ## print ar nb=0 p+=1 for i in ar: if nb<=i: nb+=1 c_ar.remove(i) ar=c_ar[::] 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...
#include <bits/stdc++.h> using namespace std; int n, i, a[10000], t, q, kol, ans[10000]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { if (ans[i] == 0) { t = 1; q = a[i]; kol++; ans[i] = -1; for (int j = i + 1; 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 main() { bool used[101] = {}; int n; int a[101] = {}; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; while (1) { int numbx = 0; bool ff = false; for (int i = 0; i < n; i++) { if (!used[i] && a[i] >= numb...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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()) li = sorted([int(x) for x in input().split()]) res = 1 for i in range(n): if (li[i] < i // res): res += 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...
# -*- coding: utf-8 -*- """ Created on Fri Jun 21 00:21:11 2019 @author: sj """ n=int(input()) s=input().split(" ") for i in range(0,n): s[i]=int(s[i]) s=sorted(s) a=[] tt=0 for i in range(0,n): c=0 for j in range(tt,len(a)): if s[i]>a[j]: a[j]+=1 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 main(void) { int n, a[105], k = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n; i++) { if (k * a[i] + k <= i) k++; } cout << 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...
/** * Created with IntelliJ IDEA. * User: igarus * Date: 13.12.13 * Time: 18:48 * To change this template use File | Settings | File Templates. */ import java.util.Arrays; import java.util.Scanner; public class CF228_C { public static void main(String[] args) { Scanner scanner = new Scanner(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() { std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int n, i; cin >> n; vector<int> a(n); for (i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int count = 0; i = 0; while (n) { i = 0; 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.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { //Scanner sc = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 itertools import combinations # from bisect import bisect_left from collections import Counter I = lambda: list(map(int, input().split())) n, a = I(), I() a.sort() h = [1] for el in a[1:]: mn = min(h) if el >= mn: h[h.index(mn)] += 1 else: h.append(1) print(len(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...
n = int(input()) ar = list(map(int,input().split(' '))) ar.sort() s=[] for i in ar: s.sort(reverse=True) for j in range(len(s)): if i>=s[j]: s[j]+=1 break else: s.append(1) print(len(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...
def isPossible(arr,pile): arr.sort(reverse=True) size = [10**18]*pile #print(arr) c = 0 for item in arr: if size[c%pile] >= 1: size[c%pile] = min(size[c%pile]-1,item) else: return False c = c + 1 return True n = int(input()) arr = [int(num) ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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()) nums = sorted(list(map(int, input().split(' ')))) v = [] b = [0] * 105 cnt = 0 k = 0 while cnt < n: k += 1 for i in range(n): if nums[i] >= len(v) and b[i] == 0: v.append(nums[i]) b[i] = 1 cnt += 1 #print(list(reversed(v))) v = [] print(k)...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const int N = 1e3; int m[N], n, tmp, ans, z; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> tmp; m[tmp]++; z += (tmp == 0); } for (int i = 0; i < 103; i++) { if (m[i]) { while (m[i]) { m[i]--; ans++; tmp = 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, a[111]; vector<int> L[111]; bool ok; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; sort(a, a + n); int cnt = 0; for (int i = 0; i < n; ++i) { ok = 1; for (int j = 0; j < cnt; ++j) { if (a[i] >= L[j].size()) { L[j].pus...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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); int n=in.nextInt(),num; int []a=new int[n]; for(int i=0;i<n;i++) a[i]=in.nextInt(); Arrays.sort(a); for (num=1;;num++) { int flag=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; bool cmp(int a, int b) { return (a > b); } bool check(int num, int x[], int N) { int cap[100]; int totalCap = 0; for (int i = 0; i < num; i++) { cap[i] = x[i]; totalCap += cap[i]; } if (totalCap < N - num) return false; for (int i = num; 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.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 visited[10000]; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int str = 0, count1 = 0; for (int i = 0; i < n; i++) { if (visited[i]) continue; count1++; str = 0; for (int j = i + 1; j < n;...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) a = list(map(int,input().split())) a.sort() res = 0 for i in range(n): cnt = i+1 lvl = a[i]+1 res = max(res , (cnt+lvl-1)//lvl) 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...
#include <bits/stdc++.h> using namespace ::std; int cols[200], a[200], sizes[200]; int main() { int n, active = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { int l = 0; while (l < active) { if (cols[l] <= a[i] && sizes[l] <= a[i]) { c...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long result = 1; while (b > 0) { if (b % 2 == 1) { result *= a; } a *= a; b /= 2; } return result; } long long gcd(long long x, long long y) { long long r; while (y != 0 && (r = x % y) != 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 n, a[110], i, hsh[110][3], j, cnt, k, ans, span; int main() { ios::sync_with_stdio(0); cin >> n; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 0, k = 0; i < n; i = j) { cnt = 1; for (j = i + 1; j < n; j++) { if (a[j] != a[i]) brea...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int n, a[101], piller; int main() { cin >> n; for (auto i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (auto i = 0; i < n; i++) { if (piller * a[i] + piller <= i) piller++; } cout << piller; }
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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], f, ans; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a, a + n); while (n) { ++ans; for (int i = 0; i < n; ++i) { if (a[i] >= f) { ++f; a[i] = 999; } } sort(a, a + n); 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.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public class A525 { public static void main(String[] Args) throws Exception{ FastScanner sc = new FastScanner(System.in); 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; int v[1000], x[1000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &x[i]); sort(x, x + n); int ans = n; int high = n; int low = 1; while (high >= low) { int flag = 1; int med = (high + low) / 2; int i = n - 1; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(raw_input()) x_s = sorted([int(i) for i in raw_input().split()]) num_piles = n for k in range(1, n+1): flag = True for i in range(n): if x_s[i] < i/k: flag = False break if flag: num_piles = k break print num_piles
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const long long OO = 0x3f3f3f3f3f3f3f3f; const int oo = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int N = 1e6 + 5; void run_case() { int n, ans = 0; cin >> n; vector<int> a(n); for (int &it : a) cin >> it; sort(a.begin(), a.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...
var n=+readline(); var x=readline().split(' ').map(function(v){return+v;}); x.sort(function(a,b){return a-b;}); var ans=[]; while(true){ var q=[] ans.push(q); for(var j=0;j<x.length;j++){ if(x[j]>=q.length){ q.push(x[j]); x.splice(j,1); j--; } } if(x.length===0){ break; } } print(ans.length);
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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]; int main() { ios_base::sync_with_stdio(false); scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a + n); for (int k = 1; k <= n; ++k) { int ok = true; for (int i = 0; i < n; ++i) if (a[i] < i / k) ok = false; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
import heapq n = int(input()) boxes = sorted(list(map(int, input().split()))) piles = [1] for b in boxes[1:]: if piles[0] <= b: heapq.heappush(piles, heapq.heappop(piles)+1) else: heapq.heappush(piles, 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...
#include <bits/stdc++.h> using namespace std; int n, a[101], c = 1, s, used[101]; int mi(int s2) { int minn = 5154541, minnn = -1; for (int i = 1; i <= n; i++) if (a[i] >= s2 && a[i] < minn && !used[i]) minn = a[i], minnn = i; used[minnn] = 1; return minnn; } bool allused(void) { for (int i = 1; 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; const int N = 1e5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed; cout.precision(10); ; int n; cin >> n; vector<int> arr(n); for (auto &i : arr) cin >> i; sort(arr.begin(), arr.end()); int temp[101]{}; int cnt = 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...
n=int(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...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > piles; vector<int> inp; int n; void process(int w) { bool can_reuse = false; for (int i = 0; i < piles.size(); i++) if (piles[i].size() <= w) { can_reuse = true; piles[i].push_back(w); return; } if (can_reuse == false) { ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = input() h = [0] A = sorted(map(int, input().split())) for x in A: if x < min(h): h += [1] else: h[h.index(min(h))]+=1 print(len(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]; priority_queue<int> f; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + 1 + n); f.push(-1); for (int i = 2; i <= n; i++) { a[i] = -a[i]; if (f.top() < a[i]) f.push(-1); else 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 sys input = sys.stdin.readline read_tuple = lambda _type: map(_type, input().split(' ')) def is_correct(seq): if len(seq) == 1: return True _len = 1 res = True for idx in range(1, len(seq)): res = res and seq[idx] >= _len _len += 1 return res def solve(): n = i...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
n = int(input()) a = [int(x) for x in input().split()] a.sort() pile,tc=0,n visited = [0]*n while tc != 0: tt=0 for i in range(0,n): if a[i]>=tt and visited[i] != 1: visited[i]=1 tt+=1 tc-=1 if(tt>0): pile+=1 print(pile)
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
'''input 2 50 50 ''' from sys import stdin def get_freq(arr): freq = [0] * (101) for i in arr: freq[i] += 1 return freq # main starts n = int(stdin.readline().strip()) arr = list(map(int, stdin.readline().split())) freq = get_freq(arr) i = 0 c = 0 while i <= 100: if freq[i] == 0: i += 1 else: freq[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...
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] boxes = new int[100+1]; for (int i=0 ; i<n ; i++) boxes[in.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...
#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...
#include <bits/stdc++.h> using namespace std; int a[101], n, res; bool can(int x) { vector<int> b(a, a + x); int k = 0; for (int j = x; j < n; ++j) { bool f = 0; int c = 0; while (c != x) { if (k == x) k = 0; if (b[k] > 0) { b[k] = min(a[j], b[k] - 1); k++; f = 1; ...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int main(void) { vector<int> piles[105]; vector<int> boxes; int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int buff; scanf("%d", &buff); boxes.push_back(buff); } sort(boxes.begin(), boxes.end()); for (int i = 1; i <= n; i++) { for (int...
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F...
#include <bits/stdc++.h> using namespace std; int p[100100]; int main() { int n, a, b, t, cn = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a; p[i] = a; } sort(p, p + n); int ans = 0; vector<int> v; for (int i = 0; i < n; i++) { int j = 0; for (j = 0; j < v.size(); j++) { if (...