Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, arr[1000];
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr, arr + n);
int last = 0, up, ans = 0;
int lp = n + 1;
while (lp--) {
for (int i = 0; i < n; i++) {
if (arr[i] >= ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.IOException;
import java.util.Arrays;
import java.io.UnsupportedEncodingException;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the to... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k, l, m, a[1000];
cin >> n;
for (i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
k = 1;
for (i = 1; i < n; i++) {
l = i / k;
if (l > a[i]) k++;
}
cout << k;
return 0;
}
| CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class Main {
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int n = scanner.nextInt();
int[] boxes = readArray(n);
boolean[] used = new boolean[n];
Arrays.sort(boxes);
int piles = 0;
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
public class Main3 {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | 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;
import java.util.ArrayList;... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | def main():
n = int(input())
boxes = sorted(list(map(int, input().split())))
remaining = []
in_use = []
ans = 0
while boxes:
for i in boxes:
if len(in_use) <= i:
in_use.append(i)
else:
remaining.append(i)
ans += 1
bo... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
import org.omg.CORBA.Any;
public class template {
public static void main(String[] args) throws IOException {
Reader scn=new Reader();
int n=scn.nextInt();
ArrayList<Integer... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = int(input())
boxes = list(map(int, input().split()))
cont = 1
i = 1
boxes.sort()
for i in range(n):
if(i//cont>boxes[i]):
cont = cont + 1
print(cont) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = input()
num = [int(i) for i in raw_input().split()]
num.sort()
for k in xrange(1,n+1):
temp = 0
for i in xrange(n):
if(num[i]<(i/k)):
temp=1
break
if(temp==0):
break
print k
| PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, a[N], x, b[N];
struct compare {
bool operator()(const int &a, const int &b) const { return a > b; }
};
set<pair<int, int> >::iterator it;
int main() {
set<pair<int, int> > st;
scanf("%d", &n);
for (int i = 0; i < (n); i++) scanf("%d", &a[i]... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | def fox(lst):
result = 1
for i in range(len(lst)):
if lst[i] < i // result:
result += 1
return result
n = int(input())
a = [int(j) for j in input().split()]
print(fox(sorted(a)))
| PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long int ans = 0;
vector<long long int> v;
long long int n;
long long int m[111];
void solve() {
sort(m, m + n);
bool flag = true;
while (flag) {
flag = false;
long long int now = 0;
for (int i = 0; i < n; i++) {
if (m[i] >= now) {
flag ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
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.StringT... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int arr[120];
int main() {
int n, i, j, t, ans = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &arr[i]);
sort(arr, arr + n);
for (i = 0; i < n; i++) {
if (arr[i] >= 0) {
ans++;
t = 1;
arr[i] = -1;
for (j = i + 1; j < n; j++) {... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 101;
int a[N];
int b[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
int ans = 0;
int used = 0;
while (used < n) {
int h = 0;
for ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
multiset<int> s;
for (int i = 0; i < n; i++) {
if (i == 0) {
s.insert(1);
continue;
}
if (v[i] == 0) {
s.... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class boredom {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int [] arr = new int[n];
int [] b=new int[n];
for(int i=0; i<n; i++) {
arr[i] = s.nextInt();
}
Arrays.sort(arr);
int count = 0;
int ans = 0;
while... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
import java.io.*;
public class boxes{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
int a =Integer.parseInt(lector.readLine());
int b[] = new int[a];
int pil = 0,i=0;
boolean c[] = new boolean[a];
int usados =... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, b, c, d, e;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
sort(a, a + n);
vector<int> pile;
pile.push_back(a[0]);
int dp[101];
memset(dp, 0, sizeof(dp));
dp[0] = 1;
for (int i = 1; i < n; i++) ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #!/usr/bin/env python
def read():
raw_input()
return map(int, raw_input().split())
def work(vList):
vList.sort()
ans = 0
while vList:
cnt = 0
idx = 0
while idx < len(vList):
if vList[idx] >= cnt:
del vList[idx]
cn... | PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.util.*;
import java.io.*;
public class FoxandBoxAccumulation {
// https://codeforces.com/contest/389/problem/C
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new Buf... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace ::std;
int n, m;
int a[105];
int pile[105];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
for (int i = 0; i < n; i++) {
int j;
for (j = m - 1; j >= 0; j--)
if (pile[j] <= a[i]) break;
if (j == -1)
pi... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | def main():
n = int(input())
l = sorted(map(int, input().split()))
res = 0
while l:
res += 1
i, l1 = 0, []
for x in l:
if x < i:
l1.append(x)
else:
i += 1
l = l1
print(res)
if __name__ == '__main__':
main()... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
public static void main(String args[... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | from collections import deque
n = int(raw_input())
boxes = sorted([int(x) for x in raw_input().split()])
piles = []
for size in boxes:
done = False
for i in range(len(piles)):
if size >= piles[i]:
new_size = piles[i] + 1
del piles[i]
piles.insert(0, new_size)
done = True
break
if not done:
piles... | PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))
n,=I()
l=sorted(I())
an=1;c=1;cr=l[0]
i=1
while i<n:
if l[i]>l[i-1]:
an=max(an,(c+cr)//(cr+1))
cr=l[i]
c+=1;i+=1
an=max(an,((c+cr)//(cr+1)))
print(an)
| PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=input()
h=[0]
for x in sorted(map(int,raw_input().split())):
if x<min(h):
h+=[1]
else:
h[h.index(min(h))]+=1
print len(h) | PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = input()
l = map(int,raw_input().split(' '))
l.sort()
done =0
for h in range(1,101):
p=0
for i in range(n):
if i/h>l[i]:
p=1
break
if p==0:
done = 1
print h
break
if done == 0:
print 100
| PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class CF388A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i ++)
a[i] = in.nextInt();
Arrays.sort(a);
TreeMap<Integer, Integer> f = new TreeMap<Integer, Integer>();
for(int i ... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k, t, Max;
int a[110], b[110][2];
while (scanf("%d", &n) != EOF) {
t = 0;
for (i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
for (i = 0; i < n; i++) b[i][1] = 0, b[i][0] = a[i];
for (i = 0; i < n; i++) {
if ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | /*
* Remember a 7.0 student can know more than a 10.0 student.
* Grades don't determine intelligence, they test obedience.
* I Never Give Up.
*/
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
p... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main
{
static boolean visited[];
static int a[];
static int count=0;
static int n;
public static void Dfs(int i )
{
visited[i] = true;
count++;
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
while len(l):
s=[]
b=0
for i in range(len(l)):
if b<=l[i]:
b=b+1
else:
s.append(l[i])
ans=ans+bool(b)
l=s
print(ans) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | input()
s = []
for x in sorted(map(int, input().split())):
if len(s) == 0:
s.append(1)
else:
for i in range(len(s)):
if x >= s[i]:
s[i] += 1
break
else:
s.append(1)
print(len(s))
| PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=int(input())
l = [int(x) for x in input().split()]
l.sort()
u = 0
a = 0
while(u<n):
a+=1
c=0
for i in range(n):
if(l[i]>=c):
c+=1
u+=1
l[i]= -1
print(a) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int x[102], pile[102];
int MN(int a, int b) { return (a < b) ? a : b; }
int main() {
int n, i, sz, j, flag;
while (scanf("%d", &n) != EOF) {
for (i = 1; i <= n; i++) {
scanf("%d", &x[i]);
}
sort(x + 1, x + n + 1);
sz = 1;
pile[sz] = 1;
for ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | # array=[4,2,2,7,8,1,2,8,10]
# i=0
# j=0
# requiredsum=8
# n=9
# currentsum=0
# currentlength=0
# minlength=99
# while(j<n):
# currentsum+=array[j]
# if (currentsum>=requiredsum):
# currentlength=j-i+1
# minlength=min(minlength,currentlength)
# currentsum-=array[i]
# i+=1
# j+=1
# pr... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, count = 0, x;
cin >> n;
long long int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (i = 0; i < n; i++) {
if (count * (a[i] + 1) <= i) count++;
}
cout << count << endl;
}
| CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m;
int num[100010];
int no[110][110];
int main() {
while (~scanf("%d", &n)) {
memset(num, 0, sizeof(num));
for (int i = 0; i < n; i++) {
scanf("%d", &num[i]);
}
sort(num, num + n);
int top = 0;
int flag;
for (int i = 0; i < n; i++)... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.lang.Math;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
public class C228 {
static class FastWriter {
private final BufferedWriter bw;
public FastWriter() {
this.bw ... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = int(input())
ar = list(map(int, input().split()))
ar.sort()
stack = 0
chosen = [False] * n
for i in range(n):
chosen[i] = False
for i in range(n):
if(chosen[i] == False):
chosen[i] = True
stack+=1
box = 1
for j in range(i, n):
if(chosen[j] == False and ar[j] >= box):
chosen[j] = True
box+=1
... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<int> A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
int use = 0, ans = 0;
while (use < n) {
ans++;
int h = 0... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class P388A {
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 < arr.length; i++) {
arr[i] = in.nextInt();
}
Arrays.sort(arr);
P... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<int> v(n);
for (auto &i : v) {
cin >> i;
}
sort(v.begin(), v.end());
vector<bool> vis(n, false);
int ans = 0;
for (int i = 0; i < n; i++) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.sql.Time;
import java.util.*;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
public class Main{
void run(){
Locale.setDefault(... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
i >> p.first >> p.second;
return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
for (auto& v : t) {
i >> v;
}
return i;
}
templat... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
/**
* @author lijiechu
* @create on 2018/10/19
* @description
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n];
boolean[]... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
inline long long int gcd(long long int a, long long int b) {
return b ? gcd(b, a % b) : a;
}
inline long long int lcm(long long int a, long long int b) {
return a * b / gcd(a, b);
}
inline long long int add(long long int a, long long i... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, a[200];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
int st = 0, ed = n;
while (ed - st > 1) {
int mid = st + ed >> 1;
for (int i = 0; i < n; i++)
if (a[i] < i / mid) {
st = mid;
break;
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(
new InputStreamRead... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.*;
import java.util.StringTokenizer;
import java.util.*;
public class Q4 {
public static void main(String[] args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(System.out);
int n=Integer.pa... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int N, A[101], M, sum, Ans;
int main() {
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A, A + N);
bool ok = false;
while (ok == false) {
sum = 0;
ok = true;
for (int i = 0; i < N; i++) {
if (sum <= A[i] && A[i] != -1) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int[] x = new int[n];
for(int i=0;i<n;i++){
x[i] = sc.nextInt();
}
sc.close();
Arrays.sort(... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[101];
int n;
cin >> n;
int i;
for (i = 1; i <= n; i++) cin >> a[i];
sort(a + 1, a + 1 + n);
int ans = 0;
int vis[1000];
memset(vis, 0, sizeof(vis));
int t = 1;
int r = n;
while (r > 0) {
t = 0;
for (i = 1; i <= n; i++) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long max3 = 1003;
const long long max4 = 10004;
const long long max5 = 100005;
const long long max6 = 1000006;
const long long max7 = 10000007;
const long long lg4 = 13;
const long long lg5 = 17;
const long long lg6 = 20;
const long long INF = 2LL * 1000000000;
c... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 200;
long long n, num[N], tmp;
int main() {
cin >> n;
for (int i = 0, v; i < n; i++) cin >> v, num[v]++;
for (int i = 1; i <= 100; i++) {
for (int j = 1; j < i; j++)
tmp = max(0ll, min(num[0] - num[j], num[i])), num[j] += tmp,
num[i] -= t... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.*;
import java.util.*;
import java.awt.*;
public class Main {
static BufferedReader br = new BufferedReader( new InputStreamReader(System.in) );
static StringTokenizer st = new StringTokenizer("");
static String next() throws Exception {
while ( !st.hasMoreTokens() ) {
String s = br.readLine(... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, value;
vector<int> arr, temp;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &value);
arr.push_back(value);
}
int cnt = 1;
while (true) {
int prev = 0;
sort(arr.begin(), arr.end());
for (int i = 0; i < arr.si... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long int n;
cin >> n;
;
long long int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
long long int dp[n];
memset(dp, 0, sizeof(dp));
long long int ans = 0;
int c1 =... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<long int> a;
int main() {
long int i, n, cnt = 0, ans = 0, temp;
cin >> n;
for (i = 0; i < n; ++i) {
cin >> temp;
(a).push_back((temp));
}
sort(&a[0], &a[n]);
while (1) {
cnt = 0;
for (i = 0; i < a.size();) {
if (a[i] >= cnt) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
import java.io.*;
public class codeforces
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = in.nextInt();
int[] a = new int[n];
boolean[] visited = new boolean[n];
int count = ... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = int(input())
a = sorted(map(int, input().split()))
c = 0
for i in range(n):
if (a[i]+1) * c <= i:
c += 1
print(c)
| PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | from itertools import *
n = int(raw_input())
x = map(int, raw_input().split())
d = {}
for e in x:
if e not in d:
d[e] = 0
d[e]+=1
k = max(d.values())
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])
... | PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.math.*;
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args ) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] in = br.readLine().split(" ");
int[] arr = new i... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n;
int a[110];
int num[110];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
num[x]++;
}
int ans = 0;
while (n) {
int weight = 0;
for (int i = 0; i <= 100; ++i) {
while (num[i] && i >= weight) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | # Made By Mostafa_Khaled
bot = True
input();print(1+max(x//-~f for x,f in enumerate(sorted(map(int,input().split())))))
# Made By Mostafa_Khaled | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
int a[120], b[120], n;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
int l = n, r = 0;
std::sort(a + 1, a + 1 + n);
int now = 0;
memset(b, 0, sizeof(b));
for (int i = 1; i <= n; ++i) {
int fl = 0;
for (int j = 1; j <= now; ++j) {
if (... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
boolean c = false;
int n = sc.nextInt(); int res = 0; int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = sc.nextInt();
Arrays.sort(a);
for (int i = 0; i < n; i++... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
public class FoxBoxAccumulation {
static void solve(){
Scanner scan= new Scanner(System.in);
int n= scan.nextInt();
int[] input= new int[101];
int cur[]= new int[101];
for(int i=0; i<n; i++){
int t=scan.nextInt();
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l, a[10000001], ans, mx = -1e9, b[10000001];
int main() {
cin >> n;
for (i = 1; i <= n; i++) cin >> a[i];
sort(a + 1, a + n + 1);
for (i = 1; i <= n; i++)
if ((a[i] + 1) * ans <= i - 1) ans++;
cout << ans << endl;
return 0;
}
| CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
vector<int> v;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
v.push_back(1);
int flag = 0;
for (int i = 1; i < n; i++) {
flag = 0;
for (int j = 0; j < v.size(); j++) {
if (a[i] >= v[j]) {
... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | /*
Aman Agarwal
algo.java
*/
import java.util.*;
import java.io.*;
public class A388
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int num[105], n;
int main() {
int cont = 0, ult;
cin >> n;
for (int i = 0; i < n; i++) cin >> num[i];
sort(num, num + n);
bool check = false;
int aux, l = 0, steps;
for (int i = 0; i < n; i++) {
check = false;
ult = num[i];
steps = 1;
if (ult !... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a[111];
int b[111];
int main() {
int n;
while (scanf("%d", &n) != EOF) {
for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
sort(b + 1, b + n + 1);
int ans = 1;
a[1] = 1;
for (int i = 2; i <= n; i++) {
int flag = 0;
for (int j = 1; j <=... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class FoxAndBoxAccumulation_R389C
{
public s... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int n, res, a[N];
bool picked[N];
void Input() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
sort(a + 1, a + n + 1);
}
void Solve() {
for (int i = 1; i <= n; i++) {
if (!picked[i]) {
int curr_boxes = 1;
for (int j = i +... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=int(input())
l=list(map(int,input().split()))
l.sort()
i=0
v=[0]*n
out=0
while i<n:
if v[i]==0:
c=0
j=i
while j<n:
if l[j]>=c and v[j]==0:
v[j]=1
c+=1
j+=1
out+=1
i+=1
print(out) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package codeforc2281;
/**
*
* @author amol
*/
import java.math.BigInteger;
import java.util.*;
public class Codeforc2281 {
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | 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
v = []
print(k)
| PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n;
int a[200];
bool check(int k) {
int pos[200];
for (int i = 0; i < k; i++) pos[i] = 1000000000;
for (int i = 0; i < n; i++) {
pos[i % k] = min(pos[i % k] - 1, a[i]);
if (pos[i % k] < 0) return 0;
}
return 1;
}
int search(int s, int f) {
if (s == f)... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.File;
import java.io.InputS... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, ar[101], flag[101] = {};
int pcount = 0, t = 1, count;
cin >> n;
for (i = 0; i < n; i++) cin >> ar[i];
sort(ar, ar + n);
while (t) {
t = 0;
pcount++;
count = 0;
for (i = 0; i < n; i++) {
if (flag[i] == 0 && ar[i] >= c... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class R228_Div1_A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> box = new ArrayList();
for(int i = 0; i < n; ++i)
box.add(sc.nextInt());
... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.io.*;
import java.util.*;
public class CF_388_A_FOX_AND_BOX_ACCUMULATION {
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner() ;
int n = sc.nextInt();
Integer [] a = new Integer [n];
for(int i = 0 ; i < n ; i++)
a[i] = sc.nextInt();
Arrays.sort(a ,Comp... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = int(input())
A = [int(a) for a in input().split()]
A.sort()
piles = 0
for i in range(n):
if A[i] == -1:
continue
size = 1
A[i] = -1
for j in range(i + 1, n):
if A[j] < size:
continue
elif A[j] > size:
size += 1
A[j] = -1
elif A[j] ... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
import java.io.*;
public class C{
public static void main(String args[]){
FastScanner in = new FastScanner(System.in);
int n = in.nextInt();
int[] list = new int[n];
for(int i = 0; i < n; i++){
list[i] = in.nextInt();
}
Arrays.sort(list);
boolean[] used = new boolean[n];
int an... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n = int(input())
a = [int(i) for i in input().split(' ')]
a.sort()
s = 1
for i in range(n):
if(a[i] < i // s):
s += 1
print(s) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=int(input())
x=list(map(int,input().split()))
x.sort()
nu=0
ans=0
mark=[]
for i in range(0,n):
mark.append(0)
for i in range(0,n):
fail=1
nu=0
for j in range(0,n):
if mark[j] == 0:
fail = 0
if x[j] >= nu:
nu+=1
mark[j]=1
if fail =... | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.Arrays;
import java.util.Scanner;
public class ma {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] str = new int[n];
int [] nb=new int [n];
for (int i = 0; i < str.length; i++) {
str[i] = sc.nextInt();
nb[i]=1;
}
Arrays.so... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | from bisect import bisect_left
input()
s = []
for i in sorted(map(int, input().split())):
k = bisect_left(s, -i)
if k == len(s): s.append(-1)
else: s[k] -= 1
print(len(s)) | PYTHON3 |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<int> vec;
vector<int>::iterator it;
int main() {
int i, n, k, x, cnt = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
vec.push_back(x);
}
sort(vec.begin(), vec.end());
while (vec.size()) {
k = 1;
vec.erase(vec.begin());
while (true) ... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | import java.util.*;
import java.util.Comparator;
import java.util.PriorityQueue;
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(... | JAVA |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | n=input()
x=sorted(map(int,raw_input().split()))
t=[0]
for b in x:
if b < min(t):
t.append(1)
else:
t[t.index(min(t))] += 1
print len(t) | PYTHON |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #include <bits/stdc++.h>
int a[110], n, c, max = 0, b[110];
int main() {
memset(a, 0, sizeof(a));
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &c);
a[c]++;
if (c > max) max = c;
}
for (int ans = 1; ans <= n; ans++) {
int ff = 1;
memset(b, 0, sizeof(b));
for (int i = 0; i... | CPP |
389_C. Fox and Box Accumulation | Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For exampl... | 2 | 9 | #import sys
#sys.stdin = open('in')
n = int(raw_input())
nums = map(int,raw_input().split())
nn = sorted(nums)
res = 1
l = [[nn[0]]]
for i in range(1, n):
ins = False
for j in range(len(l)):
if len(l[j]) <= nn[i]:
l[j].append(nn[i])
ins = True
break
if not ins:
... | PYTHON |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.