Submission #580135

# Submission time Handle Problem Language Result Execution time Memory
580135 2022-06-20T16:02:33 Z MrM7md Karte (COCI18_karte) C++17
0 / 120
99 ms 6788 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+1;
   }
   sort(a+id,a+n,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 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 1 ms 340 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 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 2896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 6788 KB Output isn't correct
2 Halted 0 ms 0 KB -