#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())
vector<ll> BlendWines(ll K, vector<ll> R)
{
ll n = (ll)R.size();
vector<ll> ret;
for(ll i = 0 ; i < n ; i++)
ret.push_back(0);
for(ll i = 0 ; i < n ; i++)
{
for(ll j = 0 ; j < n ; j++)
{
if(R[j] == i + 1)
ret[j] = i / 3 + 1;
}
}
return ret;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())
vector<int> SortWines(int K, vector<int> A)
{
ll maxx = 0;
ll n = (ll)A.size();
vector<ll> ans;
for(ll i = 0 ; i < n ; i++)
{
maxx = max(maxx, A[i]);
ans.push_back(0);
}
ll cc = 1;
for(ll i = 1 ; i <= maxx ; i++)
{
vector<ll> vec;
for(ll j = 0 ; j < n ; j++)
{
if(A[j] == i)
vec.push_back(j);
}
if((ll)vec.size() == 1)
ans[vec[0]] = cc++;
else if((ll)vec.size() == 2)
{
ll qry = Compare(vec[0], vec[1]);
if(qry == -1)
{
ans[vec[0]] = cc++;
ans[vec[1]] = cc++;
}
else
{
ans[vec[0]] = cc++;
ans[vec[1]] = cc++;
}
}
else if((ll)vec.size() == 3)
{
ll qry1 = Compare(vec[0], vec[1]);
ll qry2 = Compare(vec[0], vec[2]);
ll qry3 = Compare(vec[1], vec[2]);
ll sum = vec[0] + vec[1] + vec[2];
if(qry1 == 1 && qry2 == 1)
ans[vec[0]] = cc + 2, sum -= vec[0];
else if(qry1 == -1 && qry3 == 1)
ans[vec[1]] = cc + 2, sum -= vec[1];
else if(qry2 == -1 && qry3 == -1)
ans[vec[2]] = cc + 2, sum -= vec[2];
if(qry1 == -1 && qry2 == -1)
ans[vec[0]] = cc, sum -= vec[0];
else if(qry1 == 1 && qry3 == -1)
ans[vec[1]] = cc, sum -= vec[1];
else if(qry2 == 1 && qry3 == 1)
ans[vec[2]] = cc, sum -= vec[2];
ans[sum] = cc + 1;
cc += 3;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
516 KB |
Correct |
2 |
Correct |
0 ms |
508 KB |
Correct |
3 |
Correct |
0 ms |
616 KB |
Correct |
4 |
Correct |
0 ms |
512 KB |
Correct |
5 |
Correct |
0 ms |
512 KB |
Correct |
6 |
Correct |
0 ms |
512 KB |
Correct |
7 |
Correct |
1 ms |
520 KB |
Correct |
8 |
Correct |
1 ms |
520 KB |
Correct |
9 |
Correct |
0 ms |
520 KB |
Correct |
10 |
Correct |
1 ms |
512 KB |
Correct |
11 |
Correct |
0 ms |
520 KB |
Correct |
12 |
Correct |
0 ms |
608 KB |
Correct |
13 |
Correct |
0 ms |
616 KB |
Correct |
14 |
Correct |
0 ms |
520 KB |
Correct |
15 |
Correct |
1 ms |
520 KB |
Correct |
16 |
Correct |
1 ms |
520 KB |
Correct |
17 |
Correct |
0 ms |
524 KB |
Correct |
18 |
Correct |
1 ms |
608 KB |
Correct |
19 |
Correct |
1 ms |
512 KB |
Correct |
20 |
Correct |
1 ms |
608 KB |
Correct |
21 |
Correct |
0 ms |
516 KB |
Correct |
22 |
Correct |
0 ms |
512 KB |
Correct |
23 |
Correct |
1 ms |
512 KB |
Correct |
24 |
Correct |
0 ms |
608 KB |
Correct |
25 |
Correct |
0 ms |
520 KB |
Correct |
26 |
Correct |
1 ms |
516 KB |
Correct |
27 |
Correct |
0 ms |
608 KB |
Correct |
28 |
Correct |
1 ms |
520 KB |
Correct |
29 |
Correct |
0 ms |
512 KB |
Correct |
30 |
Correct |
1 ms |
512 KB |
Correct |
31 |
Correct |
1 ms |
600 KB |
Correct |
32 |
Correct |
0 ms |
512 KB |
Correct |
33 |
Correct |
0 ms |
512 KB |
Correct |
34 |
Correct |
0 ms |
512 KB |
Correct |
35 |
Correct |
0 ms |
512 KB |
Correct |
36 |
Correct |
1 ms |
512 KB |
Correct |
37 |
Correct |
0 ms |
512 KB |
Correct |
38 |
Correct |
0 ms |
596 KB |
Correct |
39 |
Correct |
1 ms |
512 KB |
Correct |
40 |
Correct |
2 ms |
512 KB |
Correct |
41 |
Correct |
1 ms |
512 KB |
Correct |
42 |
Correct |
0 ms |
520 KB |
Correct |
43 |
Correct |
1 ms |
516 KB |
Correct |
44 |
Correct |
0 ms |
520 KB |
Correct |
45 |
Correct |
0 ms |
596 KB |
Correct |
46 |
Partially correct |
0 ms |
520 KB |
Wrong |
47 |
Partially correct |
0 ms |
524 KB |
Wrong |
48 |
Partially correct |
0 ms |
512 KB |
Wrong |
49 |
Partially correct |
0 ms |
592 KB |
Wrong |
50 |
Partially correct |
1 ms |
512 KB |
Wrong |
51 |
Partially correct |
0 ms |
596 KB |
Wrong |
52 |
Partially correct |
1 ms |
520 KB |
Wrong |
53 |
Partially correct |
1 ms |
608 KB |
Wrong |
54 |
Partially correct |
0 ms |
596 KB |
Wrong |
55 |
Partially correct |
1 ms |
512 KB |
Wrong |
56 |
Partially correct |
0 ms |
492 KB |
Wrong |
57 |
Partially correct |
0 ms |
512 KB |
Wrong |
58 |
Partially correct |
0 ms |
512 KB |
Wrong |
59 |
Partially correct |
0 ms |
640 KB |
Wrong |
60 |
Partially correct |
1 ms |
520 KB |
Wrong |
61 |
Partially correct |
0 ms |
600 KB |
Wrong |
62 |
Partially correct |
0 ms |
512 KB |
Wrong |
63 |
Partially correct |
0 ms |
520 KB |
Wrong |
64 |
Partially correct |
1 ms |
520 KB |
Wrong |
65 |
Partially correct |
0 ms |
604 KB |
Wrong |
66 |
Partially correct |
0 ms |
592 KB |
Wrong |
67 |
Partially correct |
0 ms |
512 KB |
Wrong |
68 |
Partially correct |
1 ms |
544 KB |
Wrong |
69 |
Partially correct |
1 ms |
520 KB |
Wrong |
70 |
Partially correct |
0 ms |
512 KB |
Wrong |
71 |
Partially correct |
0 ms |
512 KB |
Wrong |
72 |
Partially correct |
0 ms |
608 KB |
Wrong |
73 |
Partially correct |
1 ms |
512 KB |
Wrong |
74 |
Partially correct |
0 ms |
512 KB |
Wrong |
75 |
Partially correct |
0 ms |
516 KB |
Wrong |
76 |
Correct |
0 ms |
508 KB |
Correct |
77 |
Partially correct |
1 ms |
512 KB |
Wrong |
78 |
Partially correct |
1 ms |
596 KB |
Wrong |
79 |
Correct |
0 ms |
512 KB |
Correct |
80 |
Partially correct |
0 ms |
596 KB |
Wrong |
81 |
Partially correct |
0 ms |
520 KB |
Wrong |
82 |
Partially correct |
0 ms |
612 KB |
Wrong |
83 |
Partially correct |
0 ms |
596 KB |
Wrong |
84 |
Partially correct |
1 ms |
520 KB |
Wrong |
85 |
Partially correct |
1 ms |
476 KB |
Wrong |
86 |
Partially correct |
1 ms |
520 KB |
Wrong |
87 |
Partially correct |
1 ms |
520 KB |
Wrong |
88 |
Correct |
0 ms |
512 KB |
Correct |
89 |
Partially correct |
0 ms |
520 KB |
Wrong |
90 |
Partially correct |
1 ms |
612 KB |
Wrong |
91 |
Correct |
0 ms |
608 KB |
Correct |
92 |
Partially correct |
0 ms |
520 KB |
Wrong |
93 |
Partially correct |
1 ms |
600 KB |
Wrong |
94 |
Partially correct |
1 ms |
604 KB |
Wrong |
95 |
Partially correct |
1 ms |
616 KB |
Wrong |
96 |
Partially correct |
0 ms |
512 KB |
Wrong |
97 |
Partially correct |
0 ms |
512 KB |
Wrong |
98 |
Partially correct |
0 ms |
512 KB |
Wrong |
99 |
Partially correct |
0 ms |
520 KB |
Wrong |
100 |
Partially correct |
0 ms |
520 KB |
Wrong |
101 |
Partially correct |
2 ms |
604 KB |
Wrong |
102 |
Partially correct |
1 ms |
512 KB |
Wrong |
103 |
Correct |
1 ms |
592 KB |
Correct |
104 |
Partially correct |
1 ms |
512 KB |
Wrong |
105 |
Partially correct |
0 ms |
512 KB |
Wrong |
106 |
Correct |
0 ms |
520 KB |
Correct |
107 |
Partially correct |
0 ms |
512 KB |
Wrong |
108 |
Partially correct |
1 ms |
520 KB |
Wrong |
109 |
Partially correct |
1 ms |
516 KB |
Wrong |
110 |
Partially correct |
0 ms |
524 KB |
Wrong |
111 |
Partially correct |
1 ms |
600 KB |
Wrong |
112 |
Partially correct |
0 ms |
520 KB |
Wrong |
113 |
Partially correct |
0 ms |
604 KB |
Wrong |
114 |
Partially correct |
0 ms |
520 KB |
Wrong |
115 |
Partially correct |
0 ms |
512 KB |
Wrong |
116 |
Partially correct |
0 ms |
604 KB |
Wrong |
117 |
Partially correct |
1 ms |
512 KB |
Wrong |
118 |
Partially correct |
0 ms |
516 KB |
Wrong |
119 |
Partially correct |
1 ms |
508 KB |
Wrong |
120 |
Partially correct |
1 ms |
576 KB |
Wrong |