# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
639749 |
2022-09-11T13:23:28 Z |
Pietra |
Karte (COCI18_karte) |
C++14 |
|
197 ms |
4924 KB |
#include<bits/stdc++.h>
using namespace std ;
// o ideal eh começar decrescente
// o ideal eh o começo ter os certos
// se quiser mudar
const int maxn = 1e5 + 5 ;
int n, k, v[maxn], ct[maxn], used[maxn], seq[maxn] ;
// pga o menorr q satisfaz smp pros verdadeiros
// pros falos coloca os maiores mais a esq
int main(){
cin >> n >> k ;
vector<int> vec, vv ;
for(int i = 0 ; i < n ; i++){
int a ; cin >> a ;
vec.push_back(a) ;
}
sort(vec.begin(), vec.end()) ; reverse(vec.begin(), vec.end()) ;
reverse(vec.begin(), vec.begin()+k) ;
int ctr = 0 ;
for(int i = 0 ; i < n ; i++){
if(ctr >= vec[i]) continue ;
else ctr++ ;
}
if(ctr != k){
cout << "-1\n" ; exit(0) ;
}
for(int i = 0 ; i < n ; i++) cout << vec[i] << " " ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
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 |
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 |
42 ms |
1356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
90 ms |
2156 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
197 ms |
4924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |