help needed

Revision en1, by mac_n_cheese_pog, 2021-07-24 06:54:38

can someone help me with this problem https://mirror.codeforces.com/contest/218/problem/A my solution is this

include <bits/stdc++.h>

using namespace std; typedef int64_t ll; int dupli[200]; int main() { int n,k; cin >> n >> k; int y[n]; int mx=0; for(int i=0;i<2*n+1;i++) { cin >> y[i]; dupli[i]=y[i]; mx=max(mx,y[i]); } sort(dupli,dupli+n); for(int i=0;i<2*n+1;i++) { for(int j=2*n;j>=2*n-k+1;j--) { if(y[i]==dupli[j] and k>0) { y[i]--; k--; } } cout << y[i] << " "; }

return 0; } idk what is wrong with it because ive been debugging for 45 mins

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English mac_n_cheese_pog 2021-07-24 06:55:46 452
en1 English mac_n_cheese_pog 2021-07-24 06:54:38 638 Initial revision (published)