Submission #150792

# Submission time Handle Problem Language Result Execution time Memory
150792 2019-09-01T08:56:27 Z 등수만큼 신재웅 생일빵 때림 (10대)(#3628, kjp4155, GodTe, JWoong148) Wine Tasting (FXCUP4_wine) C++17
16 / 100
11 ms 1036 KB
#include <bits/stdc++.h>

using namespace std;

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 6,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,_6,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define Debug1(a)           cout<<#a<<"="<<(a)<<"\n"
#define Debug2(a,b)         cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define Debug3(a,b,c)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define Debug4(a,b,c,d)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define Debug5(a,b,c,d,e)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define Debug6(a,b,c,d,e,f) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define Debug(...) macro_dispatcher(Debug, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,s,n) cout<<#a<<"=["; printarray(a,s,n); cout<<"]\n"

#define TT1 template<class T>
#define TT1T2 template<class T1, class T2>
#define TT1T2T3 template<class T1, class T2, class T3>
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v);
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p){ return os <<"("<<p.first<<", "<< p.second<<")"; }
TT1 ostream& operator << (ostream& os, const vector<T>& v){       bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v) {     bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v){    bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multiset<T1,T2>&v){bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const map<T1,T2,T3>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multimap<T1, T2>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v) { bool f = 1; os << "["; while (!v.empty()) { auto x = v.top(); v.pop(); if (!f) os << ", "; f = 0; os << x; } return os << "]"; }
TT1T2 void printarray(const T1& a, T2 l, T2 r){ for (T2 i = l; i<=r; i++) cout << a[i] << (i<r?" ":""); }

void cio(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
}

#define tt() printf("%.4f sec\n", (double) clock() / CLOCKS_PER_SEC )

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()
#define geti1(X) cin >> X
#define geti2(X,Y) cin >> X >> Y
#define geti3(X,Y,Z) cin >> X >> Y >> Z
#define geti4(X,Y,Z,W) cin >> X >> Y >> Z >> W
#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define endl '\n'

typedef tuple<int,int,int> t3;
typedef tuple<int,int,int,int> t4;


#include "bartender.h"

int N;
vector<int> A;
std::vector<int> BlendWines(int K, std::vector<int> R){
	vector<pii> v;
	N = sz(R);
	rep(i,N) v.push_back({R[i], i});
	sort(all(v));
	A.resize(N);
	int cnt = 1;
	for(int i = 0; i < N; i+=3){
		A[v[i].Se] = cnt;
		if( i+1 < N ) A[v[i+1].Se] = cnt;
		if( i+2 < N ) A[v[i+2].Se] = cnt;
		cnt++;
	}
	// Debug(R, A);
	return A;
}
#include <bits/stdc++.h>

using namespace std;

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 6,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,_6,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define Debug1(a)           cout<<#a<<"="<<(a)<<"\n"
#define Debug2(a,b)         cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define Debug3(a,b,c)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define Debug4(a,b,c,d)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define Debug5(a,b,c,d,e)   cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define Debug6(a,b,c,d,e,f) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define Debug(...) macro_dispatcher(Debug, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,s,n) cout<<#a<<"=["; printarray(a,s,n); cout<<"]\n"

#define TT1 template<class T>
#define TT1T2 template<class T1, class T2>
#define TT1T2T3 template<class T1, class T2, class T3>
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v);
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p){ return os <<"("<<p.first<<", "<< p.second<<")"; }
TT1 ostream& operator << (ostream& os, const vector<T>& v){       bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v) {     bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v){    bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multiset<T1,T2>&v){bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const map<T1,T2,T3>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multimap<T1, T2>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v) { bool f = 1; os << "["; while (!v.empty()) { auto x = v.top(); v.pop(); if (!f) os << ", "; f = 0; os << x; } return os << "]"; }
TT1T2 void printarray(const T1& a, T2 l, T2 r){ for (T2 i = l; i<=r; i++) cout << a[i] << (i<r?" ":""); }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()
#define geti1(X) cin >> X
#define geti2(X,Y) cin >> X >> Y
#define geti3(X,Y,Z) cin >> X >> Y >> Z
#define geti4(X,Y,Z,W) cin >> X >> Y >> Z >> W
#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)


#include "taster.h"

vector<int> ANS;
vector<int> v[1000];
std::vector<int> SortWines(int K, std::vector<int> A) {
	int N;
	N = A.size();
	ANS.resize(N);
	int cnt = 1;
	for (int i = 0; i < N; i++) {
		v[A[i]].push_back(i);
		// Debug(A[i]);
	}
	// Debug(v[2]);
	for(int c = 1; c <= 30; c++){
		// Debug(v[c]);
		if ( sz(v[c]) == 3 ) {
			int x = v[c][0]; int y = v[c][1]; int z = v[c][2];
			if( Compare(x,y) == 1 ) swap(x,y);
			if( Compare(x,z) == 1 ) swap(x,z);
			if( Compare(y,z) == 1 ) swap(y,z);
			ANS[x] = cnt++;
			ANS[y] = cnt++;
			ANS[z] = cnt++;
		}
		if ( sz(v[c]) == 2 ) {
			int x = v[c][0]; int y = v[c][1];
			int t = Compare(x,y);
			if( t == 1 ) swap(x,y);
			ANS[x] = cnt++;
			ANS[y] = cnt++;
		}
		if ( sz(v[c]) == 1 ) {
			ANS[v[c][0]] = cnt++;
		}
	}


	//ANS[0] = 1; ANS[1] = 3; ANS[2] = 2;
	// Debug(ANS);
	return ANS;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 644 KB Correct
2 Correct 10 ms 908 KB Correct
3 Correct 9 ms 732 KB Correct
4 Correct 8 ms 644 KB Correct
5 Correct 9 ms 908 KB Correct
6 Correct 9 ms 884 KB Correct
7 Correct 8 ms 772 KB Correct
8 Correct 9 ms 644 KB Correct
9 Correct 10 ms 944 KB Correct
10 Correct 9 ms 716 KB Correct
11 Correct 8 ms 772 KB Correct
12 Correct 9 ms 908 KB Correct
13 Correct 9 ms 1016 KB Correct
14 Correct 9 ms 772 KB Correct
15 Correct 9 ms 644 KB Correct
16 Correct 8 ms 772 KB Correct
17 Correct 8 ms 772 KB Correct
18 Correct 9 ms 772 KB Correct
19 Correct 10 ms 908 KB Correct
20 Correct 8 ms 908 KB Correct
21 Correct 10 ms 908 KB Correct
22 Correct 8 ms 1012 KB Correct
23 Correct 9 ms 908 KB Correct
24 Correct 10 ms 772 KB Correct
25 Correct 9 ms 644 KB Correct
26 Correct 10 ms 772 KB Correct
27 Correct 9 ms 772 KB Correct
28 Correct 9 ms 772 KB Correct
29 Correct 9 ms 772 KB Correct
30 Correct 9 ms 772 KB Correct
31 Correct 9 ms 780 KB Correct
32 Correct 10 ms 772 KB Correct
33 Correct 9 ms 772 KB Correct
34 Correct 9 ms 884 KB Correct
35 Correct 8 ms 644 KB Correct
36 Correct 9 ms 908 KB Correct
37 Correct 9 ms 772 KB Correct
38 Correct 10 ms 772 KB Correct
39 Correct 9 ms 644 KB Correct
40 Correct 9 ms 908 KB Correct
41 Correct 9 ms 644 KB Correct
42 Correct 10 ms 780 KB Correct
43 Correct 9 ms 644 KB Correct
44 Correct 8 ms 772 KB Correct
45 Correct 9 ms 908 KB Correct
46 Partially correct 10 ms 908 KB Wrong
47 Partially correct 10 ms 868 KB Wrong
48 Partially correct 10 ms 940 KB Wrong
49 Partially correct 9 ms 908 KB Wrong
50 Partially correct 9 ms 644 KB Wrong
51 Partially correct 10 ms 772 KB Wrong
52 Partially correct 10 ms 772 KB Wrong
53 Partially correct 9 ms 772 KB Wrong
54 Partially correct 9 ms 772 KB Wrong
55 Partially correct 10 ms 908 KB Wrong
56 Partially correct 10 ms 772 KB Wrong
57 Partially correct 10 ms 772 KB Wrong
58 Partially correct 9 ms 772 KB Wrong
59 Partially correct 10 ms 908 KB Wrong
60 Partially correct 9 ms 644 KB Wrong
61 Partially correct 10 ms 772 KB Wrong
62 Partially correct 10 ms 772 KB Wrong
63 Partially correct 9 ms 804 KB Wrong
64 Partially correct 9 ms 908 KB Wrong
65 Partially correct 11 ms 908 KB Wrong
66 Partially correct 11 ms 772 KB Wrong
67 Partially correct 10 ms 884 KB Wrong
68 Partially correct 10 ms 772 KB Wrong
69 Partially correct 10 ms 644 KB Wrong
70 Partially correct 9 ms 772 KB Wrong
71 Partially correct 10 ms 644 KB Wrong
72 Partially correct 10 ms 908 KB Wrong
73 Partially correct 10 ms 868 KB Wrong
74 Partially correct 9 ms 772 KB Wrong
75 Partially correct 8 ms 908 KB Wrong
76 Correct 10 ms 836 KB Correct
77 Correct 8 ms 1036 KB Correct
78 Correct 10 ms 908 KB Correct
79 Correct 9 ms 908 KB Correct
80 Partially correct 10 ms 772 KB Wrong
81 Partially correct 10 ms 792 KB Wrong
82 Partially correct 10 ms 768 KB Wrong
83 Partially correct 9 ms 1016 KB Wrong
84 Partially correct 10 ms 860 KB Wrong
85 Partially correct 10 ms 692 KB Wrong
86 Partially correct 7 ms 732 KB Wrong
87 Partially correct 10 ms 804 KB Wrong
88 Correct 9 ms 780 KB Correct
89 Correct 9 ms 780 KB Correct
90 Correct 9 ms 788 KB Correct
91 Correct 11 ms 1016 KB Correct
92 Partially correct 9 ms 936 KB Wrong
93 Partially correct 9 ms 780 KB Wrong
94 Partially correct 9 ms 908 KB Wrong
95 Partially correct 10 ms 772 KB Wrong
96 Partially correct 9 ms 772 KB Wrong
97 Partially correct 9 ms 772 KB Wrong
98 Partially correct 10 ms 1024 KB Wrong
99 Partially correct 10 ms 908 KB Wrong
100 Partially correct 10 ms 644 KB Wrong
101 Partially correct 9 ms 780 KB Wrong
102 Partially correct 10 ms 780 KB Wrong
103 Correct 10 ms 732 KB Correct
104 Correct 9 ms 780 KB Correct
105 Correct 10 ms 772 KB Correct
106 Correct 9 ms 896 KB Correct
107 Partially correct 10 ms 772 KB Wrong
108 Partially correct 10 ms 1012 KB Wrong
109 Partially correct 10 ms 772 KB Wrong
110 Partially correct 10 ms 772 KB Wrong
111 Partially correct 10 ms 772 KB Wrong
112 Partially correct 8 ms 772 KB Wrong
113 Partially correct 9 ms 908 KB Wrong
114 Partially correct 10 ms 772 KB Wrong
115 Partially correct 10 ms 980 KB Wrong
116 Partially correct 9 ms 784 KB Wrong
117 Partially correct 10 ms 1016 KB Wrong
118 Partially correct 10 ms 804 KB Wrong
119 Partially correct 10 ms 772 KB Wrong
120 Partially correct 9 ms 908 KB Wrong