Submission #152029

# Submission time Handle Problem Language Result Execution time Memory
152029 2019-09-06T04:24:30 Z ydk1104 Wine Tasting (FXCUP4_wine) C++17
Compilation error
0 ms 0 KB
#include "bartender.h"

std::vector<int> BlendWines(int K, std::vector<int> R){
	int N = R.size();
	for(auto &i:R){
		if(i>5) i-=4;
		else i=1;
	}
	return R;
}
#include "taster.h"

std::vector<int> SortWines(int K, std::vector<int> A) {
	int N = A.size();
	int sum[31] = {0, };
	for(int i=0; i<N; i++){
		if(A[i]>1) A[i]+=4;
		else{
			for(int j=i+1; j<N; j++){
				if(A[j]<=1){
					if(Compare(im j)==1) A[i]++;
					else sum[j]++;
				}
			}
			A[i] += sum[i];
		} 
	}
	return A;
}

Compilation message

bartender.cpp: In function 'std::vector<int> BlendWines(int, std::vector<int>)':
bartender.cpp:4:6: warning: unused variable 'N' [-Wunused-variable]
  int N = R.size();
      ^

taster.cpp: In function 'std::vector<int> SortWines(int, std::vector<int>)':
taster.cpp:11:17: error: 'im' was not declared in this scope
      if(Compare(im j)==1) A[i]++;
                 ^~
taster.cpp:11:17: note: suggested alternative: 'i'
      if(Compare(im j)==1) A[i]++;
                 ^~
                 i