Submission #580139

# Submission time Handle Problem Language Result Execution time Memory
580139 2022-06-20T16:04:00 Z MrM7md Karte (COCI18_karte) C++17
0 / 120
111 ms 6704 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define endl "\n"

const int MOD = 1e9 + 7;

int frq[1000050];
signed main(){
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   int n,k;
   cin >> n >> k;
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   sort(a,a+n);
   int f=0;
   int id=0;
   for(int i=0;i<n;i++){
      if(f<a[i]){
         f++;
      }
      if(f==k)id=i;
   }
   sort(a,a+id,greater<int>());
   if(f>=k){
      for(int i=n-1;i>=0;i--){
         cout<<a[i]<<' ';
      }
   }
   else if(f<k){
      cout<<-1;
   }


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 1620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 6704 KB Output isn't correct
2 Halted 0 ms 0 KB -