Submission #639748

# Submission time Handle Problem Language Result Execution time Memory
639748 2022-09-11T13:21:59 Z Pietra Karte (COCI18_karte) C++14
12 / 120
163 ms 2388 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 = n - 1 ; i >= 0 ; 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 0 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 32 ms 964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 1436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 2388 KB Output isn't correct
2 Halted 0 ms 0 KB -