Submission #639751

# Submission time Handle Problem Language Result Execution time Memory
639751 2022-09-11T13:25:37 Z Pietra Karte (COCI18_karte) C++14
12 / 120
178 ms 2476 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 = n-1 ; i >= 0 ; i--) cout << vec[i] << " " ;

}
# 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 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 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 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 34 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 1344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 178 ms 2476 KB Output isn't correct
2 Halted 0 ms 0 KB -