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... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
T power(T a, int n, int mod) {
T res = 1;
while (n) {
if (n % 2 == 1) res = (res * a) % mod;
n /= 2;
a = (a * a) % mod;
}
return res;
}
int maxSeq(vector<int>& v) {
int lv = v[0];
int li = 1;
vector<int> v2;
for (int 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>
#pragma comment(linker, "/STACK:2000000")
#pragma comment(linker, "/HEAP:2000000")
using namespace std;
void print_width(long long x) {
std::cout << std::fixed;
std::cout << std::setprecision(x);
}
long long power(long long x, long long y, long long p = 1000000007) {
long long res = 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;
multiset<int> S;
multiset<int>::iterator it;
int main() {
int n, x, res = 0;
scanf("%d", &n);
for (int i = 0; i < n; ++i) scanf("%d", &x), S.insert(x);
while (!S.empty()) {
++res;
int cur = *S.begin(), cnt = 1;
S.erase(S.begin());
while (!S.empty()) ... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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_N = 110;
int x[MAX_N], N, nr[MAX_N];
int main() {
cin >> N;
for (int i = 1; i <= N; ++i) cin >> x[i];
sort(x + 1, x + N + 1);
int l = 1, r = N, ans = 0;
while (l <= r) {
int mid = (l + r) / 2, aux = 0, curr = 1;
bool ev = true;
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 java.util.Arrays;
import java.util.Scanner;
public class FoxBoxAcc {
static int x[];
static boolean taken[];
static int n;
static void init() {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
x = new int[n];
taken = new boolean[n];
for(int i = 0; i < n; i++)
x[i] = 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, t, n, ans, count = 0, a[105], b[105] = {0}, k;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
b[i]++;
}
sort(a, a + n);
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
if (b[i] <= a[j]) {
b[j] = b[i] + 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 math
class CodeforcesTask388ASolution:
def __init__(self):
self.result = ''
self.n = 0
self.boxes = []
def read_input(self):
self.n = int(input())
self.boxes = [int(x) for x in input().split(" ")]
def process_task(self):
counts = [self.boxes.count(x... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import sys
import math
n = int(sys.stdin.readline())
xn = [int(x) for x in (sys.stdin.readline()).split()]
xn.sort()
k = [1]
res = 1
for i in xn[1:]:
flag = False
for t in range(res):
if(i >= k[t]):
k[t] += 1
flag = True
break
if(flag == 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... | __author__ = 'martslaaf'
a = raw_input()
table = map(int, raw_input().split(' '))
stops = 0
while table:
top = min(table)
table.remove(top)
weight = 1
while True:
sides = [x for x in table if x >= weight]
if sides:
elem = min(sides)
table.remove(elem)
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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()
s = sorted(map(int,raw_input().split()))
a = []
for i in s:
if len(a)==0:
a.append(1)
else:
if i<min(a):
a.append(1)
else:
a[a.index(min(a))]+=1
print len(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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Soly
{
static final int INF = Integer.MAX_VALUE;
static void mergeSort(int[] a,int [] c, int b, int e)
{
if(b < e)... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #coding=utf-8
n = int(raw_input())
x = map(int, raw_input().split())
x.sort()
L = list()
for i in x:
flag = True
for j in range(len(L)):
if L[j] <= i:
L[j] += 1
flag = False
break
if flag:
L.append(1)
print len(L)
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
int boxes[105];
bool used[105];
int main() {
int piles = 0, n;
cin >> n;
for (int i = 0; i < n; i++) cin >> boxes[i];
sort(boxes, boxes + n);
for (int i = 0; i < n; i++) {
if (!used[i]) {
piles++;
int idx = i + 1;
int sum = 1;
while (id... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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, arr[102], pile;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
arr[i]++;
}
sort(arr, arr + n);
for (int i = 0; i < n; i++)
if (pile * arr[i] <= i) pile++;
cout << pile << endl;... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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[100], k = 1;
set<pair<int, int> > s;
cin >> n;
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
pair<int, int> p;
p = make_pair(1, 0);
s.insert(p);
for (int i = 1; i < n; i++) {
if (a[i] >= s.begin()->first) {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 s[110], v[110];
int main() {
int n, i, j, ans, sum, p;
while (cin >> n) {
for (i = 0; i < n; i++) {
cin >> s[i];
}
sort(s, s + n);
memset(v, 0, sizeof(v));
sum = 0;
ans = 0;
while (sum < n) {
ans++;
p = 0;
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... | #include <bits/stdc++.h>
using namespace std;
int arr[105];
int mark[105];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> arr[i];
sort(arr + 1, arr + n + 1);
int res = 0;
for (int i = 1; i <= n; i++) {
if (mark[i] == true) {
continue;
}
res++;
int cnt = 1;
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... | import java.io.*;
import java.util.*;
public final class code
// public class Main
// class code
// public class Solution
{
static int n,x[];
static void solve()throws IOException
{
n=nextInt();
x=new int[n+1];
for(int i=1;i<=n;i++)
x[i]=nextInt();
Arrays.sort(x);... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.util.*;
import java.math.*;
import java.io.*;
public class B{
static int[] dx={-1,1,0,0};
static int[] dy={0,0,1,-1};
static FastReader scan=new FastReader();
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
static ArrayList<Pair>es;
static LinkedList<Inte... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
while len(l)!=0:
A=[]
k=1
ans+=1
for j in range(1,len(l)):
if(l[j]!=0 and l[j]>=k):
k+=1
else:
A.append(l[j])
l=A
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 arr[1000] = {0};
int book[1000] = {0};
int n = 0;
int ct = 0;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
sort(arr + 1, arr + n + 1);
int num = 1000;
while (1) {
num = 0;
for (int i = 1; i <= n; i++) {
if (!book[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... | from itertools import *
n = int(raw_input())
x = map(int, raw_input().split())
x = sorted(x, reverse=True)
for p in xrange(1,n+1):
bins = [200 for _ in xrange(p)]
for e in x:
_,i = max(zip(bins,xrange(p)), key=lambda a: a[0])
bins[i] = min(e,bins[i]-1)
if len(filter(lambda b: b < 0, bins)) == 0:
pr... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
public class Coder{
sta... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
OutputStream outputStream = System.out;
myScanner in = new myScanne... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 ar[])
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=s.nextInt();
Arrays.sort(a);
int piles=0; int 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.io.InputStreamReader;
import java.io.Inpu... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 M = 1e9 + 7;
void solve() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
for (int num = 1; num <= n; num++) {
int count[num], flag = 0;
for (int index = 0; index < num; index++) count[index] = 1e9;
for (int ... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
public class Main{
public static InputStream inputStream = System.in;
public static OutputStream outputStream = System.out;
public static FastReader in = new FastReader(inputStream);
public static PrintWriter out = new Prin... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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);
cin.tie(NULL);
int n;
cin >> n;
int str[n];
for (int i = 0; i < n; i++) cin >> str[i];
sort(str, str + n);
int piles = 1;
for (int boxseen = 1; boxseen < n; boxseen++) {
if (str[boxseen] < (boxseen / 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, y, cnt = 0;
vector<pair<int, int> > x;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &y);
x.push_back(make_pair(y, 0));
}
sort((x.begin()), (x.end()));
for (int j = 1; j < n; j++) {
int i = j - 1;
while (i >= 0) {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
int v[n];
for (int i = 0; i < n; i++) cin >> v[i];
sort(v, v + n);
int c = 0;
for (int i = 0; i < n; i++) {
if (v[i] == -1) continue;
int p = 1;
c++;
for (int j = i + 1; j < n; 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.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.StringT... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 as cs
n=int(input())
ls=[int(a) for a in input().split()]
ls.sort()
ls1=dict(cs(ls))
ctr1,ctr2=1,0
for i in range(n):
if ls1[ls[i]]:
ls1[ls[i]]-=1
for j in range(i,n):
if i!=j and ls[j]>=ctr1 and ls1[ls[j]]:
ctr1+=1
ls1[ls[j... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.*;
import java.util.*;
public class cf388a {
static FastIO in = new FastIO(), out = in;
public static void main(String[] args) {
int n = in.nextInt();
int[] v = new int[n];
for(int i=0; i<n; i++) v[i] = in.nextInt();
Arrays.sort(v);
int lo = 1, hi = n;
while(hi - lo > 2) {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 x[102], n, k;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> x[i];
sort(x, x + n);
for (int i = 0; i < n; i++) {
if ((x[i] + 1) * k <= i) k++;
}
cout << k;
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... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
* Created with IntelliJ IDEA.
* User: AUtemuratov
* Date: 07.04.14
* Time: ... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | # -*- coding: utf-8 -*-
n=int(raw_input())
s=map(int,raw_input().split())
s.sort()
piles=0
while s.count(-1)<n:
h=0
found=0
for i,t in enumerate(s):
if t>=h:
s[i]=-1
h+=1
piles+=1
print piles
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
long long XX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
long long YY[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const long long N = (long long)(6 * 1e5 + 10);
const long long M = 1e9 + 7;
long long fact[N], invfact[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... | # python2
import sys, threading, os.path
import collections, heapq, math,bisect
import string
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**27)
def is_valid(i,j,n):
if i >=0 and j >=0 and i<n and j<n:
return True
else:
return False
def main():
if os.path.exi... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 java.util.*;
import java.io.*;
public class Fox_and_Box_Accumulation
{
public static void main(String args[]) throws Exception
{
BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
// BufferedReader f=new BufferedReader(new FileReader("Fox_and_Box_Accumulation.in"));
int runs=Integer.p... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | n=int(input())
a=list(map(int,input().split()))
st=0
a.sort()
while len(a)!=0:
wt=1;a[0]='a'
for i in range(len(a)):
if a[i]!='a' and a[i]>=wt:
wt+=1;a[i]='a'
for i in range(a.count('a')):
a.remove('a')
st+=1
print(st)
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package fox.and.box.accumulation;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
impo... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | INF = 1000000
if __name__ == '__main__':
n = int(raw_input())
a = sorted([int(x) for x in raw_input().split()], key=lambda x: -x)
for num_piles in range(1, n + 1):
piles = [INF] * num_piles
i = 0
j = 0
while i < n:
for k in range(num_piles):
if 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... | t = []
n = int(input())
a = sorted(list(map(int , input().split())))
for i in range(n):
t = sorted(t)[::-1]
flg = True;
for j in range(len(t)):
if(a[i] >= t[j]):
t[j] += 1;flg = False;break
if(flg):t.append(1)
print(len(t))
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
bool used[200];
int x[200];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> x[i];
sort(x, x + n);
int ans = 0;
for (int i = 0; i < n; i++) {
if (used[i]) continue;
ans++;
used[i] = true;
int remain = 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;
long long gcd(long long x, long long y) {
if (y == 0)
return x;
else
return gcd(y, x % y);
}
long long expo(long long n, long long m) {
long long r = 1;
while (m > 0) {
if (m % 2) r = (r * n) % 1000000007;
n = (n * n) % 1000000007;
m = m / 2;
}... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(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 a[105];
bool kt[105];
int n, kq;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
sort(a + 1, a + 1 + n);
memset(kt, 1, sizeof(kt));
for (int i = 1; i <= n; i++)
if (kt[i]) {
kq++;
int d = 1;
int t = a[i];
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class C {
static int N;
static int[] a;
public static void main(String[] 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.Arrays;
import java.util.Scanner;
public class FoxAndBox {
public static void main(String[] args) throws Throwable {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] B = new int[N];
boolean[] used = new boolean[N];
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.util.Scanner;
public class FoxandBoxAccumulation228 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[101];
for (int i = 0; i < n; i++) {
a[sc.nextInt()]++;
}
boolean end ... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public
class Main
{
public static int GCD(int a, int b)
{
if (b==0) return a;
return GCD(b,a%b);
}
public static void main(String args[]) throws IOException
{
try{
BufferedReader br = new BufferedReader(new InputStreamRead... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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
'''
'''
#from heapq import heapify, heappop, heappush
li = lambda: list(map(int, input().split()))
n = int(input())
x = li()
x.sort()
def solve(n, x, num_piles):
piles = [x[-i] for i in range(1, num_piles+1)]
for i in reversed(range(n-num_piles)):
xi = x[... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.*;
import java.util.Arrays;
import java.util.Vector;
public class Main {
public static Reader in = new Reader();
public static Writer out = new Writer();
public static void main(String[] args) {
int n = in.readInt();
int[] x = new int[n];
for(int i=0; i<n; i++) {
x[i] = in.readInt(... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.StringTokenizer;
public class P388A {
public static void main(String[] args) {
InputStream inputStream = 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... | import java.util.*;import java.io.*;import java.math.*;
public class CF389C
{
static final Random random=new Random();
static boolean memory = true;
static void ruffleSort(int[] a) {
int n = a.length;
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 can(int mid) {
for (int i = 0; i < n; ++i)
if (i / mid > a[i]) return false;
return true;
}
int main() {
scanf("%d", &n);
for (int i = 0; i < n; ++i) scanf("%d", a + i);
sort(a, a + n);
for (int i = 1; i < 101; ++i)
if (can(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.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
public class hals {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main
{
public static void main(String[] args) throws NumberFormatException, IOException {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
int a[105], n;
bool vis[105];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
int sum = n;
int ans = 0;
int now = 0;
while (sum) {
for (int i = 0; i < n; i++) {
if (!vis[i]) {
if (a[i] >= now) {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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(raw_input())
B = sorted( int(x) for x in raw_input().split() )
res = solve(B,n)
print res
def solve(B,n):
count = 0
piles = []
for x in B:
placed = False
for p in xrange(count):
if x>=piles[p]:
piles[p] += 1
placed = True
break
if not placed:
piles.append(1)
coun... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 GCDFast(long long a, long long b) {
while (b) b ^= a ^= b ^= a %= b;
return a;
}
int dx[8] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
long long a[100005], b[105];
int main() {
long long n, i, j, k, temp, m;
long long x, y, z, 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 math import inf as inf
from math import *
from collections import *
import sys
input=sys.stdin.readline
t=1
while(t):
t-=1
n=int(input())
a=list(map(int,input().split()))
a.sort()
re=a[0]
s=0
for i in range(n):
if(s*(a[i]+1)<=i):
s+=1
print(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... | import java.util.*;
public class GoodWork {
static Scanner in =new Scanner(System.in);
static int max=1,l=1;
public static void main(String[] args) {
int n=in.nextInt();
int x[]=new int[101],p[]=new int [101];
for(int i=0;i<n;i++){int o=in.nextInt();x[o]++;}
for(int i=0;i<=100;i++){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 double EPS = -1e8;
const double Pi = acos(-1);
bool inline equ(double a, double b) { return fabs(a - b) < EPS; }
const int MAXN = 110;
int n;
vector<int> in;
int main() {
ios_base::sync_with_stdio(0);
cin >> n;
in.resize(n);
for (int i = (0); i <= (n - 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... | #include <bits/stdc++.h>
std::multiset<int> x;
std::multiset<int>::iterator it;
int n;
int kutije[102];
bool Moze(int broj) {
for (int i = 0; i < n; ++i) x.insert(kutije[i]);
int brojac = 0;
while (!x.empty()) {
for (int i = 0; i < broj; ++i) {
if (x.lower_bound(brojac) != x.end())
x.erase(x.low... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | n=int(input())
boxes=[int(x) for x in input().split()]
boxes.sort(reverse=True)
piles=[]
while boxes:
box=boxes.pop()
for pile in piles:
if box>=len(pile):
pile.append(box)
break
else:
piles.append([box])
print(len(piles))
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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()
x = sorted(map(int, raw_input().split()))
ans = 1
for i in range(n):
if x[i] < i / ans: ans += 1
print ans
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
for (int i = 0; i < n; ++i) {
int curr;
cin >> curr;
v.push_back(curr);
}
sort(v.begin(), v.end());
vector<vector<int>> piles;
for (int curr : v) {
bool placed = false;
for (auto &pile : 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, x[200], ans, cur;
bool vis[200];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> x[i];
sort(x, x + n);
for (int i = 0; i < n; i++) {
if (vis[i]) continue;
ans++;
for (int j = i + 1; j < n; j++) {
if (x[j] > cur && !vis[j]) vis[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=int(input())
a=list(map(int,input().split()))
a.sort()
dp = [0]
for i in a:
add = False
for j in range(len(dp)):
if(dp[j]<=i):
dp[j]+=1
add = True
break
if not add :
dp.append(1)
print(len(dp))
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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);
cin.tie(NULL);
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int ans = 0;
sort(arr, arr + n);
vector<int> v;
for (int i = 0; i < n; i++) {
if (v.empty())
v.push_... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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, tmp;
cin >> n;
multiset<int> a;
for (int i = 0; i < n; i++) {
cin >> tmp;
a.insert(tmp);
}
int ans = 0;
while (!a.empty()) {
int h = 0;
while (a.lower_bound(h) != a.end()) {
a.erase(a.lower_bound(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... | n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse = True)
vis = [False]*n
counter = 0
ans = 0
while counter<n:
ans+=1
init = 0
for i in range(n-1,-1,-1):
if not vis[i] and arr[i]>=init:
vis[i] = True
counter+=1
init+=1
print(ans)
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
public class Main{
public static InputStream inputStream = System.in;
public static OutputStream outputStream = System.out;
public static FastReader in = new FastReader(inputStream);
public static PrintWriter out = new PrintWriter(outp... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
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 main() {
ios_base::sync_with_stdio(false);
int n, a[102] = {0}, i, k;
cin >> n;
for (i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
for (k = 1; k <= n; k++) {
bool ans = true;
for (i = 0; i < n; i++) {
ans = ans && (a[i] >= (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... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
n=int(input())
box=[int(x) for x in input().split()]
box.sort()
k=0
for i in range(n):
if k*(box[i]+1)<=i:
k+=1
print(k)
|
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
int fx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int fy[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, i, j, k, l, f = 0;
cin >> n;
int ara[n];
for (i = 0; i < n; i++) {
cin >> ara[i];
}
sort(ara, ara... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | def arr():
return map(int,raw_input().split())
n=int(raw_input())
a=arr()
a=sorted(a)
count=0
piles=0
flag=True
while flag:
flag=False
count=0
for i in range(n):
if a[i]==-1:
continue
if a[i]>=count:
count+=1
a[i]=-1
else:
flag=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;
int a[101], vis[101] = {0};
int main() {
ios_base::sync_with_stdio(0);
;
int i, n;
cin >> n;
for (i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
int ans = 0, boxes = 0;
while (boxes < n) {
ans++;
int c = 0;
for (i = 0; i < n; i++) {
if (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 heapq
#br = open('a.in')
f = lambda: map(int, raw_input().strip().split())
n = f()[0]
a = sorted(f())
b = []
for i in a:
h = 0
for j, k in enumerate(b):
if k <= i:
b[j] += 1
h = 1
break
if h == 0:
heapq.heappush(b, 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... | import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class TaskC
{
Scanner in;
PrintWriter out;
int n;
ArrayList<Integer> elements = new ArrayList<Integer>();
int ans;
public static void main(String[] args)
{
TaskC mainTest = new TaskC();
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main2 {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... |
import java.awt.*;
import java.io.*;
import java.util.*;
public class Main {
static Main.MyScanner sc = new Main.MyScanner();
static PrintWriter out = new PrintWriter(System.out);
// static PrintStream out = System.out;
public static void main(String[] args) {
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
long long int pile[1000001], a[1000001], n;
int ok(long long int x) {
memset(pile, 0, sizeof pile);
if (n <= x) return 1;
for (long long int i = 1; i <= x; i++) pile[i] = a[i];
for (long long int i = x + 1; i <= n; i++) {
long long int no;
no = i % x;
if... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
public class B {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
InputReader s = new 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 math
n=int(input())
arr=[int(x) for x in input().split()]
arr.sort()
k=0
for i in range(n):
if k*(arr[i]+1)<=i:
k+=1
print(k) |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int m[200], n;
int mx[200];
bool isok(int r) {
for (int i = 0; i < r; ++i) mx[i] = m[i];
int j = 0;
for (int i = r; i < n; ++i) {
if (mx[j]) {
--mx[j];
mx[j] = min(mx[j], m[i]);
++j;
if (j == r) 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=int(input())
a=[int(x) for x in input().split()]
a.sort()
x=[]
for i in range(n):
c=0
for j in range(len(x)):
if x[j]<=a[i]:
c=1
x[j]+=1
break
if not c:
x.append(1)
#print(x)
print(len(x)) |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... | #include <bits/stdc++.h>
int main(void) {
int n;
scanf("%d", &n);
int x[101] = {0};
for (int i = 0, temp; i < n; i++) {
scanf("%d", &temp);
x[temp]++;
}
int ans = x[0], remain = 0;
for (int i = 1; i <= 100; i++) {
remain += ans;
if (x[i] <= remain)
remain -= x[i];
else {
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... | # coding: utf-8
n = int(raw_input())
values = [int(s) for s in raw_input().split()]
values.sort()
used = [False for _ in range(n)]
res = 0
for i in range(n):
if used[i]:
continue
total = 1
used[i] = True
res += 1
for k in range(n-i):
j = k+i
if used[j]:
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 java.util.*;
public class C{
public static void main(String... args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
while(n-->0) list.add(sc.nextInt());
int pile = 0;
while(list.size()>0){
pile++;
Collections.sort(list);
list.... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 BIGER = 1000000000000000;
const int BIG = 1000000000;
int n;
int a[101];
int f[101];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + n + 1);
int s = 0;
int g = 0;
int t = 0;
while (s < n) {
t = 0;
... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. F... |
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution {
static PrintWriter fop = new PrintWriter(System.out);
public static void main(String[] 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.*;
import java.io.*;
public class C
{
Reader in;
PrintWriter out;
int i = 0, j = 0;
void solve()
{
//START//
int n = in.nextInt();
int freq[] = new int[101];
int cur = 0;
for (i = 0; i < n; i++)
{
cur = in.nextI... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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 static java.util.Arrays.*;
import static java.lang.Math.*;
public class C {
Scanner sc = new Scanner(System.in);
void doIt()
{
int n = sc.nextInt();
int [] x = new int[n];
boolean [] used = new boolean[n]; // false
for(int i = 0; i < n; i++) x[i] = sc.nextInt();
sort(x);
int cn... |
Problem: Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the 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())
f = raw_input().split(' ')
for i in range(0, n):
f[i] = int(f[i])
f.sort()
ans = 0;
while(len(f)):
c = 0
i = 0
while(True):
if i >= len(f):
break;
if f[i] >= c:
f.pop(i)
c = c + 1
else:
i = i + 1
ans = ans ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.