#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> A(N);
for(int i = 0; i < N; i ++){
A[i] = 0;
}
for(int i = 0; i < N; i ++){
if(R[i] <= 24){
A[i] = (R[i]+3)/4;
}else{
A[i] = R[i]-18;
}
}
return A;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> SortWines(int K, std::vector<int> A) {
int N = A.size();
vector<int> ans(N);
for(int i = 0; i < N; i ++){
ans[i] = 0;
}
for(int i = 0; i < N; i ++){
if(A[i] >= 7){
ans[i] = A[i]+18;
}
}
for(int k = 1; k <= 6; k ++){
vector<int> possible1;
for(int i = 0; i < N; i ++){
if(A[i] == k){
possible1.push_back(i);
}
}
if(possible1.empty()){break;}
vector<int> order;
order.push_back(possible1[0]);
//order.push_back(0);
for(int j = 1; j <= (int)possible1.size()-1; j ++){
int lo = 0;
int hi = j;
while(lo < hi){
//printf("%d %d\n", lo, hi);
int mid = (lo+hi+1)>>1;
if(Compare(order[mid-1], possible1[j]) == -1){
lo = mid;
}else{
hi = mid-1;
}
}
order.insert(order.begin()+lo, possible1[j]);
}
for(int j = 0; j < (int)order.size(); j ++){
//printf("%d ", order[j]);
ans[order[j]] = 1 + (k-1)*4 + j;
}
for(int j = 0; j < (int)order.size(); j ++){
//printf("ans[%d]=%d\n", order[j], ans[order[j]]);
}
//printf("\n");
}
//printf("ans[%d]=%d\n", 0, ans[0]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
784 KB |
Correct |
2 |
Correct |
10 ms |
780 KB |
Correct |
3 |
Correct |
10 ms |
772 KB |
Correct |
4 |
Correct |
9 ms |
780 KB |
Correct |
5 |
Correct |
9 ms |
772 KB |
Correct |
6 |
Correct |
9 ms |
772 KB |
Correct |
7 |
Correct |
9 ms |
780 KB |
Correct |
8 |
Correct |
9 ms |
776 KB |
Correct |
9 |
Correct |
10 ms |
772 KB |
Correct |
10 |
Correct |
9 ms |
780 KB |
Correct |
11 |
Correct |
10 ms |
1020 KB |
Correct |
12 |
Correct |
9 ms |
784 KB |
Correct |
13 |
Correct |
10 ms |
784 KB |
Correct |
14 |
Correct |
9 ms |
644 KB |
Correct |
15 |
Correct |
9 ms |
908 KB |
Correct |
16 |
Correct |
8 ms |
772 KB |
Correct |
17 |
Correct |
8 ms |
772 KB |
Correct |
18 |
Correct |
8 ms |
1012 KB |
Correct |
19 |
Correct |
8 ms |
1012 KB |
Correct |
20 |
Correct |
9 ms |
924 KB |
Correct |
21 |
Correct |
8 ms |
772 KB |
Correct |
22 |
Correct |
9 ms |
780 KB |
Correct |
23 |
Correct |
8 ms |
780 KB |
Correct |
24 |
Correct |
9 ms |
772 KB |
Correct |
25 |
Correct |
8 ms |
772 KB |
Correct |
26 |
Correct |
9 ms |
784 KB |
Correct |
27 |
Correct |
10 ms |
772 KB |
Correct |
28 |
Correct |
8 ms |
780 KB |
Correct |
29 |
Correct |
9 ms |
1016 KB |
Correct |
30 |
Correct |
10 ms |
908 KB |
Correct |
31 |
Correct |
9 ms |
780 KB |
Correct |
32 |
Correct |
9 ms |
772 KB |
Correct |
33 |
Correct |
9 ms |
908 KB |
Correct |
34 |
Correct |
9 ms |
644 KB |
Correct |
35 |
Correct |
10 ms |
740 KB |
Correct |
36 |
Correct |
10 ms |
788 KB |
Correct |
37 |
Correct |
10 ms |
892 KB |
Correct |
38 |
Correct |
9 ms |
776 KB |
Correct |
39 |
Correct |
9 ms |
780 KB |
Correct |
40 |
Correct |
10 ms |
772 KB |
Correct |
41 |
Correct |
10 ms |
1012 KB |
Correct |
42 |
Correct |
9 ms |
776 KB |
Correct |
43 |
Correct |
9 ms |
1008 KB |
Correct |
44 |
Correct |
11 ms |
776 KB |
Correct |
45 |
Correct |
9 ms |
1012 KB |
Correct |
46 |
Correct |
9 ms |
1020 KB |
Correct |
47 |
Correct |
9 ms |
772 KB |
Correct |
48 |
Correct |
8 ms |
792 KB |
Correct |
49 |
Correct |
8 ms |
780 KB |
Correct |
50 |
Correct |
8 ms |
1020 KB |
Correct |
51 |
Correct |
9 ms |
780 KB |
Correct |
52 |
Correct |
10 ms |
784 KB |
Correct |
53 |
Correct |
9 ms |
788 KB |
Correct |
54 |
Correct |
9 ms |
784 KB |
Correct |
55 |
Correct |
8 ms |
788 KB |
Correct |
56 |
Correct |
9 ms |
772 KB |
Correct |
57 |
Correct |
8 ms |
776 KB |
Correct |
58 |
Correct |
8 ms |
784 KB |
Correct |
59 |
Correct |
8 ms |
780 KB |
Correct |
60 |
Correct |
9 ms |
1016 KB |
Correct |
61 |
Correct |
9 ms |
780 KB |
Correct |
62 |
Correct |
8 ms |
780 KB |
Correct |
63 |
Correct |
9 ms |
788 KB |
Correct |
64 |
Correct |
8 ms |
792 KB |
Correct |
65 |
Correct |
8 ms |
1012 KB |
Correct |
66 |
Correct |
9 ms |
1020 KB |
Correct |
67 |
Correct |
8 ms |
788 KB |
Correct |
68 |
Correct |
8 ms |
772 KB |
Correct |
69 |
Correct |
9 ms |
784 KB |
Correct |
70 |
Partially correct |
9 ms |
644 KB |
Wrong |
71 |
Partially correct |
9 ms |
772 KB |
Wrong |
72 |
Partially correct |
10 ms |
644 KB |
Wrong |
73 |
Partially correct |
8 ms |
784 KB |
Wrong |
74 |
Partially correct |
9 ms |
776 KB |
Wrong |
75 |
Partially correct |
9 ms |
772 KB |
Wrong |
76 |
Correct |
8 ms |
784 KB |
Correct |
77 |
Correct |
8 ms |
792 KB |
Correct |
78 |
Correct |
9 ms |
776 KB |
Correct |
79 |
Correct |
9 ms |
788 KB |
Correct |
80 |
Partially correct |
9 ms |
780 KB |
Wrong |
81 |
Partially correct |
9 ms |
1020 KB |
Wrong |
82 |
Partially correct |
8 ms |
792 KB |
Wrong |
83 |
Partially correct |
8 ms |
796 KB |
Wrong |
84 |
Partially correct |
8 ms |
908 KB |
Wrong |
85 |
Partially correct |
8 ms |
772 KB |
Wrong |
86 |
Partially correct |
8 ms |
780 KB |
Wrong |
87 |
Partially correct |
9 ms |
1032 KB |
Wrong |
88 |
Correct |
9 ms |
784 KB |
Correct |
89 |
Correct |
8 ms |
792 KB |
Correct |
90 |
Correct |
8 ms |
776 KB |
Correct |
91 |
Correct |
9 ms |
912 KB |
Correct |
92 |
Partially correct |
8 ms |
784 KB |
Wrong |
93 |
Partially correct |
8 ms |
784 KB |
Wrong |
94 |
Partially correct |
9 ms |
780 KB |
Wrong |
95 |
Partially correct |
8 ms |
792 KB |
Wrong |
96 |
Partially correct |
9 ms |
780 KB |
Wrong |
97 |
Partially correct |
9 ms |
792 KB |
Wrong |
98 |
Partially correct |
8 ms |
792 KB |
Wrong |
99 |
Partially correct |
8 ms |
784 KB |
Wrong |
100 |
Partially correct |
10 ms |
776 KB |
Wrong |
101 |
Partially correct |
9 ms |
908 KB |
Wrong |
102 |
Partially correct |
9 ms |
780 KB |
Wrong |
103 |
Correct |
9 ms |
1024 KB |
Correct |
104 |
Correct |
9 ms |
780 KB |
Correct |
105 |
Correct |
9 ms |
1016 KB |
Correct |
106 |
Correct |
9 ms |
664 KB |
Correct |
107 |
Partially correct |
8 ms |
772 KB |
Wrong |
108 |
Partially correct |
8 ms |
784 KB |
Wrong |
109 |
Partially correct |
8 ms |
1016 KB |
Wrong |
110 |
Partially correct |
8 ms |
784 KB |
Wrong |
111 |
Partially correct |
9 ms |
1012 KB |
Wrong |
112 |
Partially correct |
8 ms |
792 KB |
Wrong |
113 |
Partially correct |
8 ms |
788 KB |
Wrong |
114 |
Partially correct |
9 ms |
772 KB |
Wrong |
115 |
Partially correct |
8 ms |
644 KB |
Wrong |
116 |
Partially correct |
8 ms |
776 KB |
Wrong |
117 |
Partially correct |
9 ms |
772 KB |
Wrong |
118 |
Partially correct |
9 ms |
780 KB |
Wrong |
119 |
Partially correct |
9 ms |
780 KB |
Wrong |
120 |
Partially correct |
8 ms |
1016 KB |
Wrong |