Submission #150148

# Submission time Handle Problem Language Result Execution time Memory
150148 2019-09-01T07:48:31 Z 샌즈뼈(#3582, exqt, esselem) Wine Tasting (FXCUP4_wine) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "bartender.h"
using namespace std;

std::vector<int> BlendWines(int K, std::vector<int> R)
{
	int N = R.size();
	int i;
	int C=6;
	vector<int> ret(N);
	for (i=0;i<N;i++) ret[i] = max(1,R[i]-C) - 1;
	return ret;
}
#include <bits/stdc++.h>
#include "taster.h"
using namespace std;

bool comp(int e1, int e2)
{
    if (a[e1]!=a[e2]) return a[e1]<a[e2];
    return Compare(e1,e2)==-1;
}

std::vector<int> SortWines(int K, std::vector<int> A)
{
	int N = A.size();
	vector<int> arr(N), ans(N);
	int i;
	for (i=0;i<N;i++) a[i]=A[i];
	for (i=0;i<N;i++) arr[i]=i;

    sort(arr.begin(),arr.end(),comp);

    for (i=0;i<N;i++)
        ans[arr[i]] = i+1;

	return ans;
}

Compilation message

taster.cpp: In function 'bool comp(int, int)':
taster.cpp:7:9: error: 'a' was not declared in this scope
     if (a[e1]!=a[e2]) return a[e1]<a[e2];
         ^
taster.cpp: In function 'std::vector<int> SortWines(int, std::vector<int>)':
taster.cpp:16:20: error: 'a' was not declared in this scope
  for (i=0;i<N;i++) a[i]=A[i];
                    ^
taster.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (i=0;i<N;i++)
     ^~~
taster.cpp:24:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  return ans;
  ^~~~~~