Submission #149592

# Submission time Handle Problem Language Result Execution time Memory
149592 2019-09-01T06:47:54 Z From The Sky(#3630, WhipppedCream, top34051, zoomswk) Wine Tasting (FXCUP4_wine) C++17
49 / 100
11 ms 1036 KB
#include "bartender.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;

#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 35;

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

int dat[maxn];

vector<int> BlendWines(int K, std::vector<int> R){
	int n = R.size();
	for(int i = 0; i< n; i++) dat[R[i]] = i;
	vector<int> res(n);
	int fill = 0;
	for(int i = 1, cnt = 1; i<= n; i += 4, cnt++)
	{
		if(cnt> 6) break;
		if(i+3> n) break;
		res[dat[i]] = cnt;
		res[dat[i+1]] = cnt;
		res[dat[i+2]] = cnt;
		res[dat[i+3]] = cnt;
		fill = i+3;
	}
	int nxt = fill/4+1;
	for(int x = fill+1; x<= n; x++, nxt++)
	{
		res[dat[x]] = nxt;
	}
	return res;
}
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;

#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 2e5+5;

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

#include "taster.h"


vector<int> sortFour(int a, int b, int c, int d)
{
	int low1, high1, low2, high2, lowest, middle1, highest, middle2;
	if(Compare(a, b) == -1) low1 = a, high1 = b;
	else low1 = b, high1 = a;
	if(Compare(c, d) == -1) low2 = c, high2 = d;
	else low2 = d, high2 = c;
	if(Compare(low1, low2) == -1) lowest = low1, middle1 = low2;
	else lowest = low2, middle1 = low1;
	if(Compare(high1, high2) == 1) highest = high1, middle2 = high2;
	else highest = high2, middle2 = high1;
	if(Compare(middle1, middle2) == -1) return {lowest, middle1, middle2, highest};
	else return {lowest, middle2, middle1, highest};
}

vector<int> buck[35];

std::vector<int> SortWines(int K, std::vector<int> A)
{
	int n = A.size();
	for(int i = 0; i< n; i++)
	{
		buck[A[i]].pb(i);
	}
	int cur = 0;
	vector<int> ans(n);
	for(int i = 1; i<= 30; i++)
	{
		if(sz(buck[i]) == 0) continue;
		if(sz(buck[i]) == 1)
		{
			ans[buck[i][0]] = ++cur;
			continue;
		}
		vi res = sortFour(buck[i][0], buck[i][1], buck[i][2], buck[i][3]);
		ans[res[0]] = cur+1;
		ans[res[1]] = cur+2;
		ans[res[2]] = cur+3;
		ans[res[3]] = cur+4;
		cur += 4;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 772 KB Correct
2 Correct 9 ms 792 KB Correct
3 Correct 8 ms 772 KB Correct
4 Correct 10 ms 776 KB Correct
5 Correct 9 ms 884 KB Correct
6 Correct 10 ms 808 KB Correct
7 Correct 11 ms 912 KB Correct
8 Correct 11 ms 1020 KB Correct
9 Correct 10 ms 888 KB Correct
10 Correct 9 ms 784 KB Correct
11 Correct 8 ms 784 KB Correct
12 Correct 10 ms 912 KB Correct
13 Correct 9 ms 1016 KB Correct
14 Correct 10 ms 776 KB Correct
15 Correct 11 ms 888 KB Correct
16 Correct 9 ms 1036 KB Correct
17 Correct 9 ms 912 KB Correct
18 Correct 9 ms 776 KB Correct
19 Correct 10 ms 780 KB Correct
20 Correct 9 ms 912 KB Correct
21 Correct 10 ms 776 KB Correct
22 Correct 11 ms 648 KB Correct
23 Correct 11 ms 776 KB Correct
24 Correct 10 ms 784 KB Correct
25 Correct 10 ms 776 KB Correct
26 Correct 10 ms 780 KB Correct
27 Correct 11 ms 784 KB Correct
28 Correct 11 ms 776 KB Correct
29 Correct 10 ms 884 KB Correct
30 Correct 9 ms 776 KB Correct
31 Correct 10 ms 776 KB Correct
32 Correct 10 ms 880 KB Correct
33 Correct 10 ms 776 KB Correct
34 Correct 9 ms 912 KB Correct
35 Correct 10 ms 912 KB Correct
36 Correct 9 ms 892 KB Correct
37 Correct 9 ms 884 KB Correct
38 Correct 9 ms 776 KB Correct
39 Correct 9 ms 884 KB Correct
40 Correct 10 ms 912 KB Correct
41 Correct 10 ms 924 KB Correct
42 Correct 8 ms 648 KB Correct
43 Correct 10 ms 852 KB Correct
44 Correct 10 ms 872 KB Correct
45 Correct 10 ms 784 KB Correct
46 Correct 10 ms 776 KB Correct
47 Correct 10 ms 776 KB Correct
48 Correct 9 ms 784 KB Correct
49 Correct 10 ms 776 KB Correct
50 Correct 10 ms 788 KB Correct
51 Correct 10 ms 776 KB Correct
52 Correct 8 ms 776 KB Correct
53 Correct 8 ms 648 KB Correct
54 Correct 8 ms 776 KB Correct
55 Correct 10 ms 776 KB Correct
56 Correct 10 ms 784 KB Correct
57 Correct 10 ms 776 KB Correct
58 Correct 10 ms 784 KB Correct
59 Correct 10 ms 1024 KB Correct
60 Correct 10 ms 912 KB Correct
61 Correct 10 ms 784 KB Correct
62 Correct 10 ms 648 KB Correct
63 Correct 9 ms 784 KB Correct
64 Correct 10 ms 776 KB Correct
65 Correct 10 ms 776 KB Correct
66 Correct 11 ms 776 KB Correct
67 Correct 10 ms 784 KB Correct
68 Correct 10 ms 896 KB Correct
69 Correct 10 ms 668 KB Correct
70 Partially correct 9 ms 776 KB Wrong
71 Partially correct 11 ms 776 KB Wrong
72 Partially correct 10 ms 776 KB Wrong
73 Partially correct 10 ms 912 KB Wrong
74 Partially correct 9 ms 776 KB Wrong
75 Partially correct 9 ms 776 KB Wrong
76 Correct 10 ms 776 KB Correct
77 Correct 9 ms 776 KB Correct
78 Correct 9 ms 648 KB Correct
79 Correct 10 ms 788 KB Correct
80 Correct 10 ms 912 KB Correct
81 Partially correct 9 ms 880 KB Wrong
82 Partially correct 11 ms 776 KB Wrong
83 Partially correct 10 ms 912 KB Wrong
84 Partially correct 10 ms 912 KB Wrong
85 Partially correct 11 ms 776 KB Wrong
86 Partially correct 10 ms 776 KB Wrong
87 Partially correct 10 ms 1016 KB Wrong
88 Correct 10 ms 776 KB Correct
89 Correct 9 ms 884 KB Correct
90 Correct 8 ms 1020 KB Correct
91 Correct 10 ms 784 KB Correct
92 Correct 8 ms 648 KB Correct
93 Partially correct 8 ms 884 KB Wrong
94 Partially correct 10 ms 776 KB Wrong
95 Partially correct 9 ms 784 KB Wrong
96 Partially correct 10 ms 1016 KB Wrong
97 Partially correct 10 ms 780 KB Wrong
98 Partially correct 10 ms 1012 KB Wrong
99 Partially correct 10 ms 784 KB Wrong
100 Partially correct 10 ms 788 KB Wrong
101 Partially correct 10 ms 912 KB Wrong
102 Partially correct 10 ms 1012 KB Wrong
103 Correct 9 ms 648 KB Correct
104 Correct 9 ms 776 KB Correct
105 Correct 10 ms 784 KB Correct
106 Correct 9 ms 784 KB Correct
107 Partially correct 10 ms 776 KB Wrong
108 Partially correct 10 ms 912 KB Wrong
109 Partially correct 10 ms 648 KB Wrong
110 Partially correct 9 ms 904 KB Wrong
111 Partially correct 9 ms 776 KB Wrong
112 Partially correct 9 ms 840 KB Wrong
113 Partially correct 9 ms 912 KB Wrong
114 Partially correct 9 ms 776 KB Wrong
115 Partially correct 10 ms 648 KB Wrong
116 Partially correct 9 ms 884 KB Wrong
117 Partially correct 9 ms 648 KB Wrong
118 Partially correct 11 ms 912 KB Wrong
119 Partially correct 8 ms 648 KB Wrong
120 Partially correct 10 ms 912 KB Wrong