| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 84081 | wzy | Karte (COCI18_karte) | C++11 | 157 ms | 7976 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n , k;
int32_t main(){
	scanf("%d%d" , &n , &k);
	vector<int> big , small;
	for(int i = 0 ; i < n; i ++){
		int x;
		scanf("%d" , &x);
		if(x > k) big.push_back(x);
		else small.push_back(x);
	}
	sort(big.begin() , big.end());
	sort(small.begin() , small.end());
	if(big.size() > k){
		puts("-1");
		return 0;
	}
	else if(big.size() == k){
		vector<int> t;
		for(auto w : big) t.push_back(w);
		for(auto w : small) t.push_back(w);
		reverse(t.begin() , t.end());
		int fs = 0;
		for(auto w : t){
			if(w <= fs) continue;
			else fs++;
		}
		if(fs == k)
		for(auto w : t){
			printf("%d " , w);
		}
		else puts("-1");
	}
	else if(big.size() < k){
		int u = k;
		u-= (int) big.size();
		vector<int> pick;
		int fs = 0;
		for(auto &w : small){
			if(u == 0) break;
			if(w <= fs){
				continue;
			}
			else pick.push_back(w) , fs++  , u--  , w = -1;
		}
		if(u>0){
			puts("-1");
			return 0;
		}		
		for(auto w : big){
			pick.push_back(w);
		}
		for(auto w : small){
			if(w == -1) continue;
			pick.push_back(w);
		}
		fs = 0;
		bool can = true;
		for(auto w : pick){
			if(w <= fs) continue;
			else fs++;
		}
		if(fs == k){
			reverse(pick.begin() , pick.end());
			for(auto w : pick)
				printf("%d " , w );
		}
		else puts("-1");
	}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
