#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> A;
std::vector<int> BlendWines(int K, std::vector<int> R){
A.resize(R.size());
for(int i = 0; i < (int)R.size(); i++){
R[i]--;
A[i] = R[i] % 10 + 1;
}
return A;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> loc[11];
vector<int> T;
vector<int> R;
int query(int a, int b){
if(a >= (int)T.size() && b >= (int)T.size())
return min(a, b);
if(a >= (int)T.size())
return b;
if(b >= (int)T.size())
return a;
int r = Compare(a, b);
if(r == 1) return b;
return a;
}
int mn, md, mx;
int m1, m2, m3;
vector<int> SortWines(int K, std::vector<int> A) {
T = A;
for(int i = 0; i < (int)A.size(); i++){
loc[A[i]].push_back(i);
}
for(int i = A.size(); i < 30; i++){
loc[i % 10 + 1].push_back(i);
}
R.resize(30);
mx = loc[1][0];
md = loc[1][1];
mn = loc[1][2];
if(query(mn, md) == md)
swap(mn, md);
if(query(mx, md) == mx)
swap(mx, md);
if(query(mn, md) == md)
swap(mn, md);
R[mn] = 1;
R[md] = 11;
R[mx] = 21;
for(int i = 2; i <= 10; i++){
m1 = loc[i][0];
m2 = loc[i][1];
m3 = loc[i][2];
if(query(m1, md) == md)
swap(m1, m2);
if(query(m2, mx) == mx)
swap(m2, m3);
if(query(m1, md) == md)
swap(m1, m2);
R[m1] = i;
R[m2] = i + 10;
R[m3] = i + 20;
}
R.resize(A.size());
return R;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
772 KB |
Correct |
2 |
Correct |
9 ms |
772 KB |
Correct |
3 |
Correct |
9 ms |
908 KB |
Correct |
4 |
Correct |
10 ms |
980 KB |
Correct |
5 |
Correct |
9 ms |
772 KB |
Correct |
6 |
Correct |
9 ms |
908 KB |
Correct |
7 |
Incorrect |
9 ms |
772 KB |
Wrong |
8 |
Halted |
0 ms |
0 KB |
- |