#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> BlendWines(int K, std::vector<int> R){
int N = R.size();
vector<int> ret(N);
for (int i=0; i<N; i++)
ret[i] = (R[i]+2)/3;
return ret;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> B;
vector<int> arr;
bool cmp(int a, int b) {
--a, --b;
if (B[a] != B[b]) return B[a] < B[b];
return arr[a] < arr[b];
}
std::vector<int> SortWines(int K, std::vector<int> A) {
int N = A.size();
B=A;
arr.resize(N);
for (int i=0; i<N; i++) {
for (int j=0; j<i; j++) {
if (A[i] != A[j]) continue;
if (Compare(i, j) == 1) arr[i]++;
else arr[j]++;
}
}
vector<int> ret;
for (int i=1; i<=N; i++)
ret.push_back(N+1-i);
sort(ret.begin(), ret.end(), cmp);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
908 KB |
Correct |
2 |
Correct |
10 ms |
908 KB |
Correct |
3 |
Incorrect |
10 ms |
836 KB |
Wrong |
4 |
Halted |
0 ms |
0 KB |
- |