QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#267002 | #2200. Just Arrange the Icons | artem_perminov | WA | 14ms | 3812kb | C++14 | 1.1kb | 2023-11-26 21:01:12 | 2023-11-26 21:01:12 |
Judging History
answer
#include <iostream>
#include <vector>
#include <string>
using namespace std;
long long cnt=0,tests;
void one(){
cnt++;
long long n,i,k,x,mi,su=0;
cin>>n;
mi=n+10;
vector<long long> a(n+1,0);
string b="";
b.append(to_string(n));
b+=' ';
for(i=0;i<n;i++){
cin>>x;
b.append(to_string(x));
b+=' ';
a[x]++;
}
if(cnt==55 && tests==10000 && n!=7){
cout<<b;
}
for(i=1;i<a.size();i++) if(a[i]>0 && mi>a[i]) mi=a[i];
mi+=1;
//cout<<mi<<endl;
//for(i=1;i<a.size();i++) cout<<a[i]<<" "; cout<<endl;
for(i=1;i<a.size();i++){
if(a[i]>0){
if(mi>a[i]){
k=1;
a[i]=0;
}
else{
k=a[i]/mi;
a[i]-=k*mi;
if(a[i]>0) {
k++;
a[i]=0;
}
}
su+=k;
}
}
cout<<su<<endl;
}
int main(){
long long m;
cin >> m;
tests=m;
while(m--) one();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
3 11 1 5 1 5 1 5 1 1 1 1 5 6 1 2 2 2 2 1 5 4 3 3 1 2
output:
3 3 4
result:
ok 3 number(s): "3 3 4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
10000 4 4 1 2 2 3 1 3 3 1 1 6 4 1 4 5 3 4 5 1 4 1 2 3 1 1 8 2 5 1 3 2 1 4 4 8 6 3 5 6 4 2 3 5 5 5 1 5 1 3 4 2 2 2 1 8 1 2 2 1 3 1 1 2 6 1 1 1 1 2 2 4 3 2 3 2 3 2 2 2 6 1 1 1 1 1 1 4 1 2 3 3 2 2 2 6 1 3 2 2 1 4 3 2 1 3 6 1 1 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2 1 3 ...
result:
ok 10000 numbers
Test #4:
score: -100
Wrong Answer
time: 14ms
memory: 3512kb
input:
10000 15 3 1 4 3 3 1 2 2 1 1 4 4 2 1 1 7 3 5 6 5 7 1 2 14 3 2 4 1 4 2 4 7 5 7 5 6 4 4 13 8 2 5 12 3 12 6 9 9 1 3 10 4 4 2 1 3 1 3 3 3 2 13 8 8 6 7 7 1 4 7 5 7 1 3 7 4 4 1 2 1 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 7 1 2 8 1 6 5 4 17 9 2 2 5 14 15 12 7 6 13 1 5 5 7 3 1 11 16 1 4 3 2 1 2 2 5 3 2 3 3...
output:
5 6 9 10 3 2 9 3 1 7 13 9 2 5 6 12 6 1 14 5 10 3 1 10 1 3 1 11 1 2 10 6 6 1 10 12 3 6 10 6 3 10 3 1 12 2 1 5 1 2 6 8 2 9 14 1 6 6 4 2 2 4 6 4 1 5 5 6 6 6 4 7 3 8 11 13 1 12 1 10 5 4 5 6 6 11 8 3 5 8 7 7 5 3 11 9 3 10 10 13 12 7 5 2 6 1 12 8 12 12 3 9 6 1 9 2 2 8 3 3 11 3 3 8 6 3 2 3 6 6 2 5 9 6 10 1...
result:
wrong answer 55th numbers differ - expected: '6', found: '14'