Submission #150148

#TimeUsernameProblemLanguageResultExecution timeMemory
150148샌즈뼈 (#200)Wine Tasting (FXCUP4_wine)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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;
  ^~~~~~