Submission #150732

# Submission time Handle Problem Language Result Execution time Memory
150732 2019-09-01T08:52:13 Z ----MIT합격선----(#3601, maruii, Diuven, andy627) Wine Tasting (FXCUP4_wine) C++17
0 / 100
10 ms 908 KB
#include "bartender.h"

std::vector<int> BlendWines(int K, std::vector<int> R){
	int N = R.size();
	std::vector<int> A(N);
	for(int i=0; i<N; i++) A[i] = (R[i]-1)%10+1;
	return A;
}
#include "taster.h"
using namespace std;

bool ch(int a, int b){ return Compare(a,b)>0; }

std::vector<int> SortWines(int K, std::vector<int> A) {
	int n = A.size();

	vector<int> R(n), on;
	for(int i=0; i<n; i++)
		if(A[i]==1) on.push_back(i);
	
	int m = on.size();

	if(on.size()==3U){
		if(ch(on[0], on[1])) swap(on[0], on[1]);
		if(ch(on[1], on[2])) swap(on[1], on[2]);
		if(ch(on[0], on[1])) swap(on[0], on[1]);
	}
	if(on.size()==2U){
		if(ch(on[0], on[1])) swap(on[0], on[1]);
	}
	if(on.size()==1U){
	}
	for(int k=0; k<int(on.size()); k++) R[on[k]] = 10*k+1;
	
	for(int i=0; i<n; i++){
		if(A[i]==1) continue;
		if(m==1) R[i] = A[i];

		if(m==2){
			if(ch(on[1], i)) R[i] = A[i];
			else R[i] = 10+A[i];
		}
		if(m==3){

			if(ch(on[1], i)) R[i] = A[i];
			else if(ch(on[2], i)) R[i] = 10+A[i];
			else R[i] = 20+A[i];
		}
	}

	return R;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 644 KB Correct
2 Correct 8 ms 896 KB Correct
3 Correct 9 ms 772 KB Correct
4 Correct 8 ms 908 KB Correct
5 Correct 8 ms 772 KB Correct
6 Incorrect 10 ms 908 KB Wrong
7 Halted 0 ms 0 KB -