답안 #228040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228040 2020-04-29T16:22:53 Z mohamedsobhi777 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
766 ms 18484 KB
#include<bits/stdc++.h>

using namespace std ;

const int N = 1e5 + 7 ; 

int n , k ;
priority_queue<pair<int, int > > mu ; 

vector<pair<int , int> > arr ; 

int main(){
    ios_base::sync_with_stdio(0) ; 
    cin.tie(0) ; 
    //freopen("in.in" , "r" , stdin) ; 
    cin>>n>>k ; 

    for(int i = 0 ; i < n ; i++){
        int t ; 
        cin>>t ; 
        mu.push({ -t , i }) ; 
        arr.push_back({t , i }) ; 
    }
    while(mu .size() > 1){
        pair<int , int > t1 = mu.top() ; mu.pop() ; 
        pair<int , int > t2 = mu.top() ; mu.pop() ; 
        if(t1.first == t2.first ){
            mu.push({ t1.first -1 , t1.second -2 });
            continue ; 
        }
        else{
            mu.push(t2) ;
            mu.push(t1) ;
            mu.push(t1) ;  
            arr.push_back( t1 ); 
            k-- ; 
        }
    }
    sort(arr.begin() , arr.end() , [&] (pair<int , int > p1 , pair<int , int > p2) {
        return p1.second < p2.second ; 
    }) ; 
    int tp = -mu.top().first;
    for(int i = tp + k -1 ; i >= tp ; i --){
        cout<<i<<" ";
    } 
    for(auto u : arr){
        cout<<abs(u.first) <<" " ; 
    }

    return 0 ; 
} 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 671 ms 18324 KB not a zalsequence
2 Incorrect 658 ms 18332 KB not a zalsequence
3 Incorrect 676 ms 18484 KB not a zalsequence
4 Incorrect 643 ms 18348 KB not a zalsequence
5 Incorrect 659 ms 18352 KB not a zalsequence
6 Incorrect 651 ms 18324 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 640 ms 18352 KB not a zalsequence
2 Incorrect 670 ms 18340 KB not a zalsequence
3 Incorrect 701 ms 18412 KB not a zalsequence
4 Incorrect 699 ms 18436 KB not a zalsequence
5 Incorrect 664 ms 18316 KB not a zalsequence
6 Incorrect 721 ms 18320 KB not a zalsequence
7 Incorrect 766 ms 18312 KB not a zalsequence
8 Incorrect 682 ms 18308 KB not a zalsequence
9 Incorrect 541 ms 16084 KB not a zalsequence
10 Incorrect 251 ms 10700 KB not a zalsequence
11 Incorrect 375 ms 12796 KB not a zalsequence
12 Incorrect 98 ms 7248 KB not a zalsequence
13 Incorrect 81 ms 7288 KB not a zalsequence
14 Incorrect 84 ms 7204 KB not a zalsequence