#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> BlendWines(int k, vector<int> r){
int n = r.size();
if(k<10){
for(int i=0;i<n;i++){
r[i]=1;
}
return r;
}
vector<int> v;
for(int i=0;i<n;i++){
r[i]=r[i]%10+1;
}
return r;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> SortWines(int k, vector<int> a) {
int n = a.size();
vector<int> v[11],ans;
ans.resize(n);
for(int i=0;i<n;i++){
v[a[i]].push_back(i);
}
for(int i=1;i<=10;i++){
if(v[i].size()==0) continue;
else if(v[i].size()==1){
ans[v[i][0]]=i;
}
else if(v[i].size()==2){
if(Compare(v[i][0],v[i][1])>0) swap(v[i][0],v[i][1]);
ans[v[i][0]]=i;
ans[v[i][1]]=i+10;
}
else{
for(int t=0;t<3;t++){
for(int j=0;j<t;j++){
if(Compare(v[i][t],v[i][j])>0) swap(v[i][t],v[i][j]);
}
}
for(int t=0;t<3;t++) ans[v[i][t]]=i+10*t;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
924 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |