Submission #4422381


Source Code Expand

Copy
//#define NDEBUG

#pragma GCC optimize ("O3") // 最適化レベルの変更 O0〜O3 などを指定
#pragma GCC optimize("-O3,inline,omit-frame-pointer,unroll-loops")
#pragma warning(1:4456) // 多重forループ内での変数の2重定義を警告にする

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <array>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <math.h>
#include <fstream>
#include <string>
#include <sstream>
#include <cmath>

#include <memory>
#include <cassert>

#include <functional>
#include <chrono>

using namespace std;
using namespace chrono;

const int DX[] = {	0,	-1,	 0,	 1};
const int DY[] = { -1,	 0,	 1,	 0};

const int DX8[] = {	 0,	-1, -1, -1, 0, 1, 1,  1};
const int DY8[] = { -1, -1,  0,	 1, 1, 1, 0, -1};

namespace ValLib {

	typedef unsigned long long ull;

	template<typename Key, typename Value>
	using umap = std::unordered_map<Key, Value>;
	template<typename T>
	using uset = std::unordered_set<T>;
	template <typename T>
	using sptr = typename std::shared_ptr<T>;

	class NullStream {
	public:
		template<typename T> NullStream& operator<<(T const&) { return *this; }
	};

#ifdef NDEBUG
#define vcerr if(false) NullStream()
#define vendl nullptr
#else
#define vcerr std::cerr
#define vendl std::endl
#endif

	template<typename T> void fill(vector<T>& vec, const T& value) { std::fill(vec.begin(), vec.end(), value); }
	template<typename T> void fill(vector<vector<T>>& vec, const T& value) { for (vector<T>& t : vec) std::fill(t.begin(), t.end(), value); }
	template<typename T> void resize(vector<vector<T>>& vec, int size1, int size2) { vec.resize(size1); for (vector<T>& t : vec) t.resize(size2); }
	template<typename T> void resize(vector<vector<T>>& vec, int size1, int size2, const T& value) { vec.resize(size1); for (vector<T>& t : vec) t.resize(size2, value); }
	template<typename T> void assign(vector<vector<T>>& vec, int size1, int size2, const T& value) { vec.resize(size1); for (vector<T>& t : vec) t.assign(size2, value); }
	template <typename T> const typename vector<T>::const_iterator max_element(const vector<T>& vec) { assert(!vec.empty()); return std::max_element(vec.begin(), vec.end()); }
	template <typename T, typename _Pr> const typename vector<T>::const_iterator max_element(const vector<T>& vec, _Pr lessThan) { assert(!vec.empty()); return std::max_element(vec.begin(), vec.end(), lessThan); }
	template <typename T> typename vector<T>::iterator min_element(vector<T>& vec) { assert(!vec.empty()); return std::min_element(vec.begin(), vec.end()); }
	template <typename T> const typename vector<T>::const_iterator min_element(const vector<T>& vec) { assert(!vec.empty()); return std::min_element(vec.begin(), vec.end()); }
	template <typename T, typename _Pr> const typename vector<T>::const_iterator min_element(const vector<T>& vec, _Pr lessThan) { assert(!vec.empty()); return std::min_element(vec.begin(), vec.end(), lessThan); }
	int accumulate(const vector<int>& vec) { return std::accumulate(vec.begin(), vec.end(), 0); }
	template <typename _Pr> int accumulate(const vector<int>& vec, _Pr func) { return std::accumulate(vec.begin(), vec.end(), 0, func); }
	double accumulate(const vector<double>& vec) { return std::accumulate(vec.begin(), vec.end(), 0.0); }
	template <typename _Pr> double accumulate(const vector<double>& vec, _Pr func) { return std::accumulate(vec.begin(), vec.end(), 0.0, func); }
	float accumulate(const vector<float>& vec) { return std::accumulate(vec.begin(), vec.end(), 0.f); }
	template <typename _Pr>	float accumulate(const vector<float>& vec, _Pr func) { return std::accumulate(vec.begin(), vec.end(), 0.f, func); }
	template <typename T, typename _Pr>	bool all_of(const vector<T>& vec, _Pr pred) { return std::all_of(vec.begin(), vec.end(), pred);	}
	template <typename T, typename _Pr>	bool any_of(const vector<T>& vec, _Pr pred) { return std::any_of(vec.begin(), vec.end(), pred); }
	template <typename T, typename _Pr>	bool none_of(const vector<T>& vec, _Pr pred) { return std::none_of(vec.begin(), vec.end(), pred); }
	template <typename T> const typename vector<T>::const_iterator find(const vector<T>& vec, const T& val) { return std::find(vec.begin(), vec.end(), val); }
	template <typename T, typename _Pr>	const typename vector<T>::const_iterator find_if(const vector<T>& vec, _Pr pred) { return std::find_if(vec.begin(), vec.end(), pred); }
	template <typename T> bool contains(const vector<T>& vec, const T& val) { return std::find(vec.begin(), vec.end(), val) != vec.end(); }
	template <typename T, typename _Pr>	bool contains_if(const vector<T>& vec, _Pr pred) { return std::find_if(vec.begin(), vec.end(), pred) != vec.end(); }
	template <typename T, typename _Pr> typename iterator_traits<const typename vector<T>::const_iterator>::difference_type count_if(const vector<T>& vec, _Pr pred) { return std::count_if(vec.begin(), vec.end(), pred); }

	template<typename T, size_t N> void fill(array<T, N>& ary, const T& value) { std::fill(ary.begin(), ary.end(), value); }
	template<typename T, size_t N, size_t M> void fill(array<array<T, M>, N>& ary, const T& value) { for (array<T, M>& t : ary) std::fill(t.begin(), t.end(), value); }
	template <typename T, size_t N, typename _Pr> const typename array<T, N>::const_iterator max_element(const array<T, N>& ary) { assert(!ary.empty()); return std::max_element(ary.begin(), ary.end()); }
	template <typename T, size_t N, typename _Pr> const typename vector<T>::const_iterator max_element(const array<T, N>& ary) { assert(!ary.empty()); return std::max_element(ary.begin(), ary.end()); }
	template <typename T, size_t N, typename _Pr> const typename array<T, N>::const_iterator max_element(const array<T, N>& ary, _Pr lessThan) { assert(!ary.empty()); return std::max_element(ary.begin(), ary.end(), lessThan); }
	template <typename T, size_t N, typename _Pr> const typename array<T, N>::const_iterator min_element(const array<T, N>& ary) { assert(!ary.empty()); return std::min_element(ary.begin(), ary.end()); }
	template <typename T, size_t N, typename _Pr> const typename array<T, N>::const_iterator min_element(const array<T, N>& ary, _Pr lessThan) { assert(!ary.empty()); return std::min_element(ary.begin(), ary.end(), lessThan); }
	template <size_t N>	int accumulate(const array<int, N>& ary) { return std::accumulate(ary.begin(), ary.end(), 0); }
	template <size_t N, typename _Pr> int accumulate(const array<int, N>& ary, _Pr func) { return std::accumulate(ary.begin(), ary.end(), 0, func); }
	template <size_t N> double accumulate(const array<double, N>& ary) { return std::accumulate(ary.begin(), ary.end(), 0.0); }
	template <size_t N, typename _Pr> double accumulate(const array<double, N>& ary, _Pr func) { return std::accumulate(ary.begin(), ary.end(), 0.0, func); }
	template <size_t N> float accumulate(const array<float, N>& ary) { return std::accumulate(ary.begin(), ary.end(), 0.f); }
	template <size_t N, typename _Pr> float accumulate(const array<float, N>& ary, _Pr func) { return std::accumulate(ary.begin(), ary.end(), 0.f, func); }
	template <typename T, size_t N, typename _Pr> bool all_of(const array<T, N>& ary, _Pr pred) { return std::all_of(ary.begin(), ary.end(), pred); }
	template <typename T, size_t N, typename _Pr> bool any_of(const array<T, N>& ary, _Pr pred) { return std::any_of(ary.begin(), ary.end(), pred); }
	template <typename T, size_t N, typename _Pr> bool none_of(const array<T, N>& ary, _Pr pred) { return std::none_of(ary.begin(), ary.end(), pred); }
	template <typename T, size_t N> const typename array<T, N>::const_iterator find(const array<T, N>& ary, const T& val) { return std::find(ary.begin(), ary.end(), val); }
	template <typename T, size_t N, typename _Pr> const typename array<T, N>::const_iterator find_if(const array<T, N>& ary, _Pr pred) { return std::find_if(ary.begin(), ary.end(), pred); }
	template <typename T, size_t N> bool contains(const array<T, N>& ary, const T& val) { return std::find(ary.begin(), ary.end(), val) != ary.end(); }
	template <typename T, size_t N, typename _Pr> bool contains_if(const array<T, N>& ary, _Pr pred) { return std::find_if(ary.begin(), ary.end(), pred) != ary.end(); }
	template <typename T, size_t N, typename _Pr> typename iterator_traits<const typename array<T, N>::const_iterator>::difference_type count_if(const array<T, N>& ary, _Pr pred) { return std::count_if(ary.begin(), ary.end(), pred); }

	template<typename T>
	const typename uset<T>::const_iterator find(const uset<T>& s, const T& key) {
		return s.find(key);
	}

	inline bool same(double a, double b) {
		return abs(a - b) < 0.00000000001;
	}

	unsigned long long xor128() {
		static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123;
		unsigned long long rt = (rx ^ (rx << 11));
		rx = ry;
		ry = rz;
		rz = rw;
		return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
	}
}

using namespace ValLib;

constexpr int MAX_TURN = 1000;
constexpr int N = 8;
int D, T;
array<int, N> Caps;
array<int, N> Amounts;

void input() {
	cin >> D >> T;
	for (int i = 0; i < N; ++i) {
		cin >> Caps[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> Amounts[i];
	}
}

void fill(int index) {
	cout << "fill " << (index + 1) << endl;
}
void sell(const vector<int>& indexes) {
	cout << "sell ";
	cout << indexes.size();
	for (int i = 0; i < indexes.size(); ++i) {
		cout << " " << (indexes[i] + 1);
	}
	cout << endl;
}
void sell(int index) {
	vector<int> x(1, index);
	sell(x);
}
void pass() {
	cout << "pass" << endl;
}

void solve() {
	for (int i = 0; i < N; ++i) {
		if (D == Amounts[i]) {
			sell(i);
			return;
		}
	}
	for (int i = 0; i < N; ++i) {
		if (D == Caps[i]) {
			fill(i);
			return;
		}
	}
	pass();
}

int main()
{
	std::ios::sync_with_stdio(false);

	for (int turn = 0; turn < MAX_TURN; ++turn) {
		input();
		solve();
	}

}

Submission Info

Submission Time
Task A - 石油王Xの憂鬱
User ValGrowth
Language C++14 (GCC 5.4.1)
Score 154490
Code Size 10172 Byte
Status
Exec Time 52 ms
Memory 724 KB

Judge Result

Set Name Score / Max Score Test Cases
test_01 2161 / 417500 subtask_01_01.txt
test_02 4065 / 417500 subtask_01_02.txt
test_03 3414 / 417500 subtask_01_03.txt
test_04 3096 / 417500 subtask_01_04.txt
test_05 3661 / 417500 subtask_01_05.txt
test_06 2916 / 417500 subtask_01_06.txt
test_07 2556 / 417500 subtask_01_07.txt
test_08 2873 / 417500 subtask_01_08.txt
test_09 3475 / 417500 subtask_01_09.txt
test_10 3499 / 417500 subtask_01_10.txt
test_11 3672 / 417500 subtask_01_11.txt
test_12 2778 / 417500 subtask_01_12.txt
test_13 2313 / 417500 subtask_01_13.txt
test_14 3103 / 417500 subtask_01_14.txt
test_15 3261 / 417500 subtask_01_15.txt
test_16 3184 / 417500 subtask_01_16.txt
test_17 3247 / 417500 subtask_01_17.txt
test_18 3052 / 417500 subtask_01_18.txt
test_19 3072 / 417500 subtask_01_19.txt
test_20 2891 / 417500 subtask_01_20.txt
test_21 3460 / 417500 subtask_01_21.txt
test_22 2063 / 417500 subtask_01_22.txt
test_23 3692 / 417500 subtask_01_23.txt
test_24 3524 / 417500 subtask_01_24.txt
test_25 3092 / 417500 subtask_01_25.txt
test_26 2234 / 417500 subtask_01_26.txt
test_27 3177 / 417500 subtask_01_27.txt
test_28 3454 / 417500 subtask_01_28.txt
test_29 3854 / 417500 subtask_01_29.txt
test_30 2912 / 417500 subtask_01_30.txt
test_31 3413 / 417500 subtask_01_31.txt
test_32 2888 / 417500 subtask_01_32.txt
test_33 2645 / 417500 subtask_01_33.txt
test_34 2025 / 417500 subtask_01_34.txt
test_35 3123 / 417500 subtask_01_35.txt
test_36 3786 / 417500 subtask_01_36.txt
test_37 3060 / 417500 subtask_01_37.txt
test_38 3294 / 417500 subtask_01_38.txt
test_39 2787 / 417500 subtask_01_39.txt
test_40 3058 / 417500 subtask_01_40.txt
test_41 2816 / 417500 subtask_01_41.txt
test_42 3021 / 417500 subtask_01_42.txt
test_43 3849 / 417500 subtask_01_43.txt
test_44 3320 / 417500 subtask_01_44.txt
test_45 3150 / 417500 subtask_01_45.txt
test_46 3268 / 417500 subtask_01_46.txt
test_47 1813 / 417500 subtask_01_47.txt
test_48 2299 / 417500 subtask_01_48.txt
test_49 3861 / 417500 subtask_01_49.txt
test_50 3263 / 417500 subtask_01_50.txt
Case Name Status Exec Time Memory
subtask_01_01.txt 51 ms 720 KB
subtask_01_02.txt 52 ms 724 KB
subtask_01_03.txt 50 ms 596 KB
subtask_01_04.txt 47 ms 596 KB
subtask_01_05.txt 48 ms 720 KB
subtask_01_06.txt 50 ms 640 KB
subtask_01_07.txt 46 ms 716 KB
subtask_01_08.txt 50 ms 724 KB
subtask_01_09.txt 50 ms 592 KB
subtask_01_10.txt 51 ms 720 KB
subtask_01_11.txt 49 ms 596 KB
subtask_01_12.txt 50 ms 724 KB
subtask_01_13.txt 46 ms 676 KB
subtask_01_14.txt 51 ms 724 KB
subtask_01_15.txt 48 ms 592 KB
subtask_01_16.txt 51 ms 720 KB
subtask_01_17.txt 49 ms 676 KB
subtask_01_18.txt 50 ms 656 KB
subtask_01_19.txt 51 ms 720 KB
subtask_01_20.txt 49 ms 716 KB
subtask_01_21.txt 48 ms 724 KB
subtask_01_22.txt 48 ms 720 KB
subtask_01_23.txt 48 ms 724 KB
subtask_01_24.txt 52 ms 592 KB
subtask_01_25.txt 49 ms 720 KB
subtask_01_26.txt 49 ms 676 KB
subtask_01_27.txt 49 ms 716 KB
subtask_01_28.txt 50 ms 676 KB
subtask_01_29.txt 50 ms 724 KB
subtask_01_30.txt 47 ms 724 KB
subtask_01_31.txt 46 ms 596 KB
subtask_01_32.txt 49 ms 724 KB
subtask_01_33.txt 51 ms 720 KB
subtask_01_34.txt 52 ms 716 KB
subtask_01_35.txt 50 ms 668 KB
subtask_01_36.txt 49 ms 720 KB
subtask_01_37.txt 47 ms 724 KB
subtask_01_38.txt 48 ms 596 KB
subtask_01_39.txt 50 ms 592 KB
subtask_01_40.txt 52 ms 724 KB
subtask_01_41.txt 50 ms 592 KB
subtask_01_42.txt 48 ms 596 KB
subtask_01_43.txt 51 ms 720 KB
subtask_01_44.txt 52 ms 724 KB
subtask_01_45.txt 46 ms 724 KB
subtask_01_46.txt 50 ms 724 KB
subtask_01_47.txt 52 ms 724 KB
subtask_01_48.txt 51 ms 724 KB
subtask_01_49.txt 50 ms 724 KB
subtask_01_50.txt 49 ms 724 KB