Submission #149008

#TimeUsernameProblemLanguageResultExecution timeMemory
149008Seishun Buta Yarou wa Yumemiru Shoujo no Yume wo Minai (#200)Wine Tasting (FXCUP4_wine)C++17
57 / 100
11 ms1060 KiB
#include "bartender.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> BlendWines(int k, vector<int> r) {
	vector<int> a;
	for(int i=0; i<r.size(); ++i) {
		--r[i];
		if(!r[i])
			a.push_back(11);
		else
			a.push_back(r[i]%10+1);
	}
	return a;
}
#include "taster.h"
#include <bits/stdc++.h>
using namespace std;

int n;
vector<int> c[12];

//i<j
bool cmp(int i, int j) {
	if(i>=n||j>=n)
		return i<j;
	return Compare(i, j)<0;
}

vector<int> SortWines(int k, vector<int> a) {
	n=a.size();
	for(int i=a.size(); i<30; ++i)
		a.push_back(i%10+1);
	vector<int> b(30);
	for(int i=0; i<30; ++i)
		c[a[i]].push_back(i);
	b[c[11][0]]=1;
	if(!cmp(c[1][0], c[1][1]))
		swap(c[1][0], c[1][1]);
	b[c[1][0]]=11;
	b[c[1][1]]=21;
	for(int i=2; i<11; ++i) {
		//find 2
		if(cmp(c[1][1], c[i][0]))
			swap(c[i][0], c[i][2]);
		else if(cmp(c[1][1], c[i][1]))
			swap(c[i][1], c[i][2]);
		//find 1
		if(cmp(c[1][0], c[i][0]))
			swap(c[i][0], c[i][1]);
		for(int j=0; j<3; ++j)
			b[c[i][j]]=j*10+i;
	}
	return vector<int>(b.begin(), b.begin()+n);
}

Compilation message (stderr)

bartender.cpp: In function 'std::vector<int> BlendWines(int, std::vector<int>)':
bartender.cpp:7:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<r.size(); ++i) {
               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...