Submission #247136

# Submission time Handle Problem Language Result Execution time Memory
247136 2020-07-11T06:38:59 Z dantoh000 Wine Tasting (FXCUP4_wine) C++17
43 / 100
11 ms 1036 KB
#include <bits/stdc++.h>
#include "bartender.h"
using namespace std;
vector<int> BlendWines(int K, vector<int> R){
	int N = R.size();
    vector<int> A(N);
    for (int i = 0; i < N; i++){
        if (R[i] == N) A[i] = K;
        else if (R[i] == N/2) A[i] = 1;
        else{
            int dif = min(N-R[i],R[i]);
            A[i] = max(1,K-dif);
        }
        //printf("%d ",A[i]);
    }
    //printf("\n");
	return A;
}
#include <bits/stdc++.h>
using namespace std;
#include "taster.h"
bool cmp(int a, int b){
    return Compare(a,b) == 1;
}
vector<int> SortWines(int K, vector<int> A) {
	int N = A.size();
	vector<int> pos[K+1];
	for (int i = 0; i < N ; i++){
        pos[A[i]].push_back(i);
	}
	vector<int> R(N);
	int l = 1, r = N;

	for (int i = K; i >= 1; i--){
        if (pos[i].size() == 1){
            R[pos[i][0]] = r--;
        }
        else if (pos[i].size() == 2){
            if (Compare(pos[i][0],pos[1][0]) == 1){
                R[pos[i][0]] = r--;
                R[pos[i][1]] = l++;
            }
            else{
                R[pos[i][1]] = r--;
                R[pos[i][0]] = l++;
            }
        }
        else{
            sort(pos[i].begin(),pos[i].end(),cmp);
            for (auto x : pos[i]){
                R[x] = r--;
            }
        }
	}
	for (int i = 0; i < N; i++){
        //printf("%d ",R[i]);
	}

	return R;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 784 KB Correct
2 Correct 9 ms 788 KB Correct
3 Correct 9 ms 780 KB Correct
4 Correct 8 ms 776 KB Correct
5 Correct 9 ms 776 KB Correct
6 Correct 10 ms 1012 KB Correct
7 Correct 8 ms 788 KB Correct
8 Correct 8 ms 784 KB Correct
9 Correct 9 ms 776 KB Correct
10 Correct 9 ms 1016 KB Correct
11 Correct 9 ms 784 KB Correct
12 Correct 9 ms 776 KB Correct
13 Correct 9 ms 896 KB Correct
14 Correct 8 ms 784 KB Correct
15 Correct 10 ms 788 KB Correct
16 Correct 10 ms 1008 KB Correct
17 Correct 9 ms 648 KB Correct
18 Correct 9 ms 776 KB Correct
19 Correct 9 ms 792 KB Correct
20 Correct 10 ms 816 KB Correct
21 Correct 9 ms 1012 KB Correct
22 Correct 10 ms 796 KB Correct
23 Correct 10 ms 784 KB Correct
24 Correct 9 ms 1020 KB Correct
25 Correct 11 ms 784 KB Correct
26 Correct 10 ms 792 KB Correct
27 Correct 10 ms 784 KB Correct
28 Correct 9 ms 784 KB Correct
29 Correct 9 ms 776 KB Correct
30 Correct 10 ms 780 KB Correct
31 Correct 9 ms 784 KB Correct
32 Correct 9 ms 888 KB Correct
33 Correct 9 ms 780 KB Correct
34 Correct 9 ms 1016 KB Correct
35 Correct 8 ms 804 KB Correct
36 Correct 9 ms 1016 KB Correct
37 Correct 9 ms 888 KB Correct
38 Correct 9 ms 788 KB Correct
39 Correct 8 ms 784 KB Correct
40 Correct 9 ms 1024 KB Correct
41 Correct 8 ms 776 KB Correct
42 Correct 10 ms 776 KB Correct
43 Correct 9 ms 1036 KB Correct
44 Correct 9 ms 1036 KB Correct
45 Correct 10 ms 780 KB Correct
46 Correct 8 ms 784 KB Correct
47 Correct 9 ms 784 KB Correct
48 Correct 9 ms 780 KB Correct
49 Correct 9 ms 1012 KB Correct
50 Correct 8 ms 880 KB Correct
51 Correct 10 ms 776 KB Correct
52 Correct 9 ms 776 KB Correct
53 Correct 9 ms 788 KB Correct
54 Correct 8 ms 784 KB Correct
55 Correct 10 ms 776 KB Correct
56 Correct 10 ms 780 KB Correct
57 Correct 8 ms 784 KB Correct
58 Correct 8 ms 792 KB Correct
59 Correct 8 ms 780 KB Correct
60 Correct 9 ms 1020 KB Correct
61 Correct 9 ms 776 KB Correct
62 Correct 9 ms 792 KB Correct
63 Correct 9 ms 784 KB Correct
64 Correct 9 ms 776 KB Correct
65 Correct 10 ms 780 KB Correct
66 Correct 9 ms 776 KB Correct
67 Partially correct 9 ms 788 KB Wrong
68 Partially correct 9 ms 780 KB Wrong
69 Partially correct 11 ms 1016 KB Wrong
70 Partially correct 10 ms 1012 KB Wrong
71 Partially correct 9 ms 1016 KB Wrong
72 Partially correct 8 ms 776 KB Wrong
73 Partially correct 10 ms 784 KB Wrong
74 Partially correct 10 ms 648 KB Wrong
75 Partially correct 10 ms 784 KB Wrong
76 Correct 9 ms 1008 KB Correct
77 Correct 9 ms 788 KB Correct
78 Correct 10 ms 776 KB Correct
79 Correct 10 ms 1008 KB Correct
80 Correct 8 ms 780 KB Correct
81 Correct 8 ms 776 KB Correct
82 Partially correct 9 ms 632 KB Wrong
83 Partially correct 9 ms 784 KB Wrong
84 Partially correct 9 ms 784 KB Wrong
85 Partially correct 10 ms 780 KB Wrong
86 Partially correct 9 ms 828 KB Wrong
87 Correct 9 ms 776 KB Correct
88 Correct 9 ms 776 KB Correct
89 Correct 9 ms 784 KB Correct
90 Correct 9 ms 648 KB Correct
91 Correct 10 ms 912 KB Correct
92 Correct 9 ms 784 KB Correct
93 Partially correct 10 ms 808 KB Wrong
94 Partially correct 8 ms 776 KB Wrong
95 Partially correct 9 ms 648 KB Wrong
96 Partially correct 10 ms 776 KB Wrong
97 Partially correct 8 ms 648 KB Wrong
98 Partially correct 9 ms 912 KB Wrong
99 Partially correct 8 ms 648 KB Wrong
100 Partially correct 10 ms 912 KB Wrong
101 Partially correct 9 ms 788 KB Wrong
102 Partially correct 9 ms 648 KB Wrong
103 Correct 9 ms 784 KB Correct
104 Correct 9 ms 912 KB Correct
105 Correct 9 ms 1020 KB Correct
106 Correct 9 ms 880 KB Correct
107 Correct 9 ms 776 KB Correct
108 Partially correct 9 ms 648 KB Wrong
109 Partially correct 9 ms 776 KB Wrong
110 Partially correct 10 ms 912 KB Wrong
111 Partially correct 8 ms 888 KB Wrong
112 Partially correct 10 ms 776 KB Wrong
113 Partially correct 9 ms 776 KB Wrong
114 Partially correct 10 ms 1012 KB Wrong
115 Partially correct 10 ms 792 KB Wrong
116 Partially correct 8 ms 788 KB Wrong
117 Partially correct 10 ms 780 KB Wrong
118 Partially correct 9 ms 912 KB Wrong
119 Partially correct 8 ms 776 KB Wrong
120 Partially correct 8 ms 648 KB Wrong