QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323925 | #8134. LCA Counting | ucup-team055# | WA | 0ms | 3620kb | C++17 | 562b | 2024-02-10 14:18:56 | 2024-02-10 14:18:56 |
Judging History
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'