QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#266956#2200. Just Arrange the Iconsartem_perminovWA 21ms3408kbC++141020b2023-11-26 20:21:432023-11-26 20:21:43

Judging History

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

  • [2023-11-26 20:21:43]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:3408kb
  • [2023-11-26 20:21:43]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;
long long way;
void one(){
    long long n,i,k,x,mi,su=0;
    cin>>n;
    mi=n+2;
    vector<long long> a(n+1,0);
    vector<long long> b(n,0);
    for(i=0;i<n;i++){
        cin>>x;
        b[i]=x;
        a[x]++;
    }
    if(way==99844){
        cout<<n<<endl;
        for(i=0;i<b.size();i++) cout<<b[i]<<" ";
    }
    for(i=1;i<a.size();i++) if(a[i] && 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]){
            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(){

    cin >> way;
    while(way--) one();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3408kb

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: 15ms
memory: 3376kb

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

result:

ok 10000 numbers

Test #4:

score: -100
Wrong Answer
time: 21ms
memory: 3352kb

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
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
10
9
12
4
2
4
3
12
10
2
4
10
6
5...

result:

wrong answer 56th numbers differ - expected: '6', found: '4'