#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> BlendWines(int k,vector<int> r)
{
int n=r.size(),b=(n+2)/3;
vector<int> ans;
for (int i=0;i<n;i++)
{
if (n==4)
ans.push_back((r[i]==4)+1);
else
ans.push_back((r[i]-1)%b+1);
}
return ans;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> d[3];
bool cmp(int a,int b)
{
return Compare(a,b)==-1;
}
void go(int l,int r,vector<pair<int,int> > &tmp,int j)
{
if (l==r)
{
d[tmp[l].second].push_back(j);
tmp.erase(tmp.begin()+l);
}
else
{
int mid=(l+r+1)/2;
if (Compare(tmp[mid].first,j)==-1)
go(mid,r,tmp,j);
else
go(l,mid-1,tmp,j);
}
}
vector<int> SortWines(int k,vector<int> a)
{
int n=a.size();
vector<int> v,r(n);
for (int i=0;i<n;i++)
{
if (a[i]==1)
v.push_back(i);
}
sort(v.begin(),v.end(),cmp);
if (n<3)
{
for (int i=0;i<n;i++)
r[v[i]]=i+1;
return r;
}
for (int i=0;i<3;i++)
d[i].push_back(v[i]);
for (int i=2;i<=n;i++)
{
vector<pair<int,int> > tmp;
for (int j=0;j<3;j++)
tmp.push_back({v[j],j});
for (int j=0;j<n;j++)
{
if (a[j]==i)
go(0,tmp.size()-1,tmp,j);
}
}
vector<int> ans;
for (int i=0;i<3;i++)
{
for (int j:d[i])
ans.push_back(j);
}
for (int i=0;i<n;i++)
r[ans[i]]=i+1;
return r;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
908 KB |
Correct |
2 |
Correct |
9 ms |
908 KB |
Correct |
3 |
Correct |
9 ms |
1012 KB |
Correct |
4 |
Correct |
9 ms |
844 KB |
Correct |
5 |
Correct |
9 ms |
772 KB |
Correct |
6 |
Correct |
9 ms |
732 KB |
Correct |
7 |
Correct |
10 ms |
772 KB |
Correct |
8 |
Correct |
8 ms |
644 KB |
Correct |
9 |
Correct |
9 ms |
644 KB |
Correct |
10 |
Correct |
10 ms |
940 KB |
Correct |
11 |
Correct |
9 ms |
1060 KB |
Correct |
12 |
Correct |
9 ms |
924 KB |
Correct |
13 |
Correct |
8 ms |
772 KB |
Correct |
14 |
Correct |
9 ms |
796 KB |
Correct |
15 |
Correct |
9 ms |
644 KB |
Correct |
16 |
Correct |
10 ms |
772 KB |
Correct |
17 |
Correct |
9 ms |
908 KB |
Correct |
18 |
Correct |
10 ms |
716 KB |
Correct |
19 |
Correct |
9 ms |
772 KB |
Correct |
20 |
Correct |
9 ms |
908 KB |
Correct |
21 |
Correct |
10 ms |
772 KB |
Correct |
22 |
Correct |
10 ms |
772 KB |
Correct |
23 |
Correct |
10 ms |
684 KB |
Correct |
24 |
Correct |
9 ms |
772 KB |
Correct |
25 |
Correct |
10 ms |
772 KB |
Correct |
26 |
Correct |
8 ms |
772 KB |
Correct |
27 |
Correct |
9 ms |
644 KB |
Correct |
28 |
Correct |
9 ms |
772 KB |
Correct |
29 |
Correct |
9 ms |
772 KB |
Correct |
30 |
Correct |
10 ms |
772 KB |
Correct |
31 |
Correct |
9 ms |
772 KB |
Correct |
32 |
Correct |
10 ms |
908 KB |
Correct |
33 |
Correct |
10 ms |
772 KB |
Correct |
34 |
Correct |
9 ms |
728 KB |
Correct |
35 |
Correct |
9 ms |
772 KB |
Correct |
36 |
Correct |
9 ms |
884 KB |
Correct |
37 |
Correct |
9 ms |
908 KB |
Correct |
38 |
Correct |
8 ms |
772 KB |
Correct |
39 |
Correct |
10 ms |
884 KB |
Correct |
40 |
Correct |
9 ms |
820 KB |
Correct |
41 |
Correct |
8 ms |
908 KB |
Correct |
42 |
Correct |
10 ms |
644 KB |
Correct |
43 |
Correct |
10 ms |
908 KB |
Correct |
44 |
Correct |
9 ms |
908 KB |
Correct |
45 |
Correct |
8 ms |
884 KB |
Correct |
46 |
Correct |
10 ms |
772 KB |
Correct |
47 |
Correct |
9 ms |
784 KB |
Correct |
48 |
Correct |
10 ms |
772 KB |
Correct |
49 |
Correct |
10 ms |
644 KB |
Correct |
50 |
Correct |
10 ms |
884 KB |
Correct |
51 |
Correct |
10 ms |
772 KB |
Correct |
52 |
Correct |
10 ms |
844 KB |
Correct |
53 |
Correct |
13 ms |
908 KB |
Correct |
54 |
Partially correct |
11 ms |
868 KB |
Wrong |
55 |
Correct |
10 ms |
732 KB |
Correct |
56 |
Correct |
10 ms |
780 KB |
Correct |
57 |
Correct |
12 ms |
960 KB |
Correct |
58 |
Correct |
9 ms |
1012 KB |
Correct |
59 |
Correct |
10 ms |
888 KB |
Correct |
60 |
Correct |
10 ms |
776 KB |
Correct |
61 |
Correct |
10 ms |
772 KB |
Correct |
62 |
Partially correct |
10 ms |
772 KB |
Wrong |
63 |
Correct |
10 ms |
780 KB |
Correct |
64 |
Correct |
10 ms |
908 KB |
Correct |
65 |
Correct |
9 ms |
772 KB |
Correct |
66 |
Correct |
10 ms |
908 KB |
Correct |
67 |
Correct |
10 ms |
888 KB |
Correct |
68 |
Correct |
11 ms |
772 KB |
Correct |
69 |
Correct |
10 ms |
908 KB |
Correct |
70 |
Correct |
9 ms |
780 KB |
Correct |
71 |
Correct |
9 ms |
908 KB |
Correct |
72 |
Correct |
10 ms |
908 KB |
Correct |
73 |
Partially correct |
10 ms |
772 KB |
Wrong |
74 |
Partially correct |
9 ms |
772 KB |
Wrong |
75 |
Partially correct |
9 ms |
644 KB |
Wrong |
76 |
Correct |
9 ms |
780 KB |
Correct |
77 |
Correct |
10 ms |
1016 KB |
Correct |
78 |
Correct |
9 ms |
1012 KB |
Correct |
79 |
Correct |
9 ms |
772 KB |
Correct |
80 |
Correct |
10 ms |
772 KB |
Correct |
81 |
Correct |
9 ms |
772 KB |
Correct |
82 |
Partially correct |
9 ms |
908 KB |
Wrong |
83 |
Partially correct |
10 ms |
772 KB |
Wrong |
84 |
Partially correct |
10 ms |
772 KB |
Wrong |
85 |
Partially correct |
10 ms |
812 KB |
Wrong |
86 |
Partially correct |
9 ms |
644 KB |
Wrong |
87 |
Partially correct |
8 ms |
1012 KB |
Wrong |
88 |
Correct |
10 ms |
772 KB |
Correct |
89 |
Correct |
11 ms |
788 KB |
Correct |
90 |
Correct |
9 ms |
856 KB |
Correct |
91 |
Correct |
11 ms |
884 KB |
Correct |
92 |
Correct |
11 ms |
772 KB |
Correct |
93 |
Partially correct |
12 ms |
780 KB |
Wrong |
94 |
Partially correct |
12 ms |
848 KB |
Wrong |
95 |
Partially correct |
12 ms |
784 KB |
Wrong |
96 |
Partially correct |
11 ms |
792 KB |
Wrong |
97 |
Partially correct |
11 ms |
772 KB |
Wrong |
98 |
Partially correct |
11 ms |
776 KB |
Wrong |
99 |
Partially correct |
9 ms |
1020 KB |
Wrong |
100 |
Partially correct |
9 ms |
772 KB |
Wrong |
101 |
Partially correct |
10 ms |
788 KB |
Wrong |
102 |
Partially correct |
10 ms |
780 KB |
Wrong |
103 |
Correct |
9 ms |
908 KB |
Correct |
104 |
Correct |
10 ms |
656 KB |
Correct |
105 |
Correct |
10 ms |
784 KB |
Correct |
106 |
Correct |
9 ms |
896 KB |
Correct |
107 |
Correct |
10 ms |
792 KB |
Correct |
108 |
Partially correct |
10 ms |
884 KB |
Wrong |
109 |
Partially correct |
15 ms |
772 KB |
Wrong |
110 |
Partially correct |
10 ms |
772 KB |
Wrong |
111 |
Partially correct |
10 ms |
780 KB |
Wrong |
112 |
Partially correct |
9 ms |
788 KB |
Wrong |
113 |
Partially correct |
10 ms |
1016 KB |
Wrong |
114 |
Partially correct |
10 ms |
884 KB |
Wrong |
115 |
Partially correct |
10 ms |
644 KB |
Wrong |
116 |
Partially correct |
10 ms |
932 KB |
Wrong |
117 |
Partially correct |
10 ms |
1012 KB |
Wrong |
118 |
Partially correct |
10 ms |
1012 KB |
Wrong |
119 |
Partially correct |
9 ms |
772 KB |
Wrong |
120 |
Partially correct |
9 ms |
908 KB |
Wrong |