結果

問題 No.766 金魚すくい
ユーザー naimonon77naimonon77
提出日時 2019-01-12 21:20:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 5,030 bytes
コンパイル時間 2,767 ms
コンパイル使用メモリ 195,300 KB
実行使用メモリ 200,548 KB
最終ジャッジ日時 2024-12-23 04:08:07
合計ジャッジ時間 56,054 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 TLE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define NOMINMAX
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " : " << (x) << " "
#define dumpl(x) dump(x) << endl
#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const int undefined = INF;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

string join(const vector<string>& v, const string delim = 0) {
	string s;
	if (!v.empty()) {
		s += v[0];
		for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
			if (delim != "") s += delim;
			s += v[i];
		}
	}
	return s;
}

string operator * (const string& s, const int& n) {
	string res = "";
	rep(i, n) res += s;
	return res;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T bit_count(T N) {
	T cnt = 0;
	while (N) {
		if (N & 1) cnt++;
		N >>= 1;
	}
	return cnt;
}

template<typename T>
void print_vec(ostream& ostream, vector<T> a) {
	rep(i, a.size() - 1) ostream << a[i] << " ";
	ostream << a.back() << endl;
}

ll pow_n(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

template<class T, class U>
T mod_pow(T x, U n) {
	T res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		x %= mod_n;
		n >>= 1;
		res %= mod_n;
	}
	return res;
}

template<class T>
T mod_rev(T a) {
	T res = 1;
	return mod_pow(a, mod_n - 2);
}

int H, W;

bool grid_ng(int y, int x) {
	return y < 0 || y >= H || x < 0 || x >= W;
}

struct Point {
	int x, y;
	bool operator < (const Point& r) const {
		if (y != r.y) return y < r.y;
		return x < r.x;
	}
};

int n, m, p;
vector<map<int, int>> insuubunnkai_vec;

class Solver {
public:
	void insuubunnkai() {
		insuubunnkai_vec.resize(max(n + m + 5, (ll)1000));
		rep2(i, 1, insuubunnkai_vec.size()) {
			int cur = i;
			rep2(j, 2, 1000) {
				while (cur % j == 0) {
					insuubunnkai_vec[i][j] += 1;
					cur /= j;
					//dump(i); dump(j); dumpl(cur);
				}
			}
		}
	}

	struct Frac {
		map<int, int> p, q;
		void p_add(int v) {
			for (auto& a : insuubunnkai_vec[v]) {
				p[a.first] += a.second;
			}
		}
		void q_add(int v) {
			for (auto& a : insuubunnkai_vec[v]) {
				q[a.first] += a.second;
			}
		}
	};

	Frac a;

	void solve() {
		cin >> n >> m >> p;
		vector<int> v(n);
		rep(i, n) cin >> v[i];

		sort(all(v), greater<int>());
		insuubunnkai(); 
		cerr << "!!!!!!!" << endl;
		Frac cur; 
		rep(i, m) cur.p_add(p);
		rep(i, m + n + 1) {
			cur.q[2] += 2;
			cur.q[5] += 2;
		}
		rep(i, n + 1) {
			cur.p[2] += 2;
			cur.p[5] += 2;
		}
		rep2(i, 1, n + 1) cur.q_add(i);
		a.q = cur.q;
		rep(i, n + 1) {
			for (auto& p : cur.p) {
				a.p[p.first] += p.second;
			}			
			if (i < n) {
				for (auto& p : insuubunnkai_vec[v[i]]) {
					cur.p[p.first] -= p.second;
				}
			}
			for (auto& p : insuubunnkai_vec[i]) {
				cur.p[p.first] -= p.second;
			}
			cur.p_add(m + i);
			cur.p_add(100 - p);
			if (i < n) cur.p_add(v[i]);
		}
		for (auto p : a.p) {
			while (p.second > 0 && a.q[p.first] > 0) {
				p.second -= 1;
				a.q[p.first] -= 1;
			}
		}
		for (auto p : a.p) {
			cerr << p.first << " " << p.second << endl;
		}
		cerr << "q -------------------" << endl;
		for (auto p : a.q) {
			cerr << p.first << " " << p.second << endl;
		}
	}
};

signed main()
{
	srand((unsigned int)time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}
0