QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323925#8134. LCA Countingucup-team055#WA 0ms3620kbC++17562b2024-02-10 14:18:562024-02-10 14:18:56

Judging History

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

  • [2024-02-10 14:18:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-02-10 14:18:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define all(p) p.begin(),p.end()
using ll =long long;

void solve(){
    int N;
    cin>>N;
    vector<int> p(N);
    rep(i,0,N-1){
        int a;
        cin>>a;
        p[a-1]++;
    }
    int M=0,L=0;
    rep(i,0,N){
        if(p[i]!=1) M++;
        if(p[i]==0) L++;
    }
    rep(i,0,L){
        if(i) cout<<" ";
        cout<<min(M,2*i+1);
    }
    cout<<"\n";
}

int main(){
    int T=1;
    //cin>>T;
    while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

7
1 1 2 4 2 2

output:

1 3 5 6

result:

ok 4 number(s): "1 3 5 6"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3620kb

input:

10
1 1 2 2 1 1 1 2 4

output:

1 3 5 7 9 9 9

result:

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