#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<9){
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]%9+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(),p=9;
vector<int> v[31],ans;
ans.resize(n);
for(int i=0;i<n;i++){
v[a[i]].push_back(i);
}
for(int i=1;i<=p;i++){
for(int t=0;t<v[i].size();t++){
for(int j=0;j<t;j++){
if(Compare(v[i][j],v[i][t])>0) swap(v[i][t],v[i][j]);
}
}
for(int t=0;t<v[i].size();t++) ans[v[i][t]]=i+p*t;
}
for(int i=0;i<n;i++){
if(ans[i]%p==1) ans[i]=ans[i]+p-1;
else ans[i]=ans[i]-1;
}
return ans;
}
Compilation message
taster.cpp: In function 'std::vector<int> SortWines(int, std::vector<int>)':
taster.cpp:13:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int t=0;t<v[i].size();t++){
~^~~~~~~~~~~~
taster.cpp:18:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int t=0;t<v[i].size();t++) ans[v[i][t]]=i+p*t;
~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
772 KB |
Correct |
2 |
Correct |
8 ms |
772 KB |
Correct |
3 |
Correct |
9 ms |
908 KB |
Correct |
4 |
Correct |
9 ms |
884 KB |
Correct |
5 |
Correct |
10 ms |
1024 KB |
Correct |
6 |
Correct |
8 ms |
772 KB |
Correct |
7 |
Incorrect |
9 ms |
644 KB |
Wrong |
8 |
Halted |
0 ms |
0 KB |
- |