QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#266999#2200. Just Arrange the Iconsartem_perminovWA 4ms3428kbC++141.1kb2023-11-26 20:59:562023-11-26 20:59:56

Judging History

你现在查看的是最新测评结果

  • [2023-11-26 20:59:56]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3428kb
  • [2023-11-26 20:59:56]
  • 提交

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){
        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: 1ms
memory: 3416kb

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: -100
Wrong Answer
time: 4ms
memory: 3428kb

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 1 1 1 1
7
1 2 1 3 1 2 3
5
1 1 1 1 1
5
2 2 1 3 1
5
2 3 4 1 3
3
1 1 1
6
3 3 1 ...

output:

3
2
1
5
4
1
5
5
3
3
5
3
2
1
1
3
1
4
3
1
3
1
3
4
1
5
1
3
4
4
2
4
3
7
3
1
2
5
4
4
5
1
5
1
2
1
3
1
1
4
1
3
1
4
7 2 6 1 2 5 6 4 5
3
3
2
5
1
1
2
5
1
3
1
5
1
4
2
3
2
2
4
3
6
2
5
2
2
4
1
1
5
1
2
4
3
3
3
3
4
1
3
4
6
3
1
4
1
1
4
1
4
2
1
2
3
2
2
1
2
1
2
1
5
1
3
3
6
1
3
1
2
1
3
4
1
4
1
1
3
6
1
3
3
5
5
2
1
1
4
...

result:

wrong answer 55th numbers differ - expected: '5', found: '7'