help needed

Правка en1, от mac_n_cheese_pog, 2021-07-24 06:54:38

can someone help me with this problem https://codeforces.me/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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский mac_n_cheese_pog 2021-07-24 06:55:46 452
en1 Английский mac_n_cheese_pog 2021-07-24 06:54:38 638 Initial revision (published)