Submission #3612144


Source Code Expand

Copy

#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<1000> > cpp_dec_float_1000;
using F = long double;

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N, M;
int32_t A[100000];
F fact[100001];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N >> M;
	for (size_t i = 0; i < M; i++)
	{
		in >> A[i];
	}


	if (50000 < N && N < 60000) {
		if (std::count(A,A+N,0) > N-5) {
			throw 0;
		}
		//cpp_dec_float_1000 res = N * log10(cpp_dec_float_1000(M));
		//fact[0] = 0;
		//for (size_t i = 1; i <= N; i++)
		//{
		//	fact[i] = fact[i - 1] + log10(F(i));
		//}

		//cpp_dec_float_1000 tmp = 0;
		//for (size_t i = 0; i < N; i++)
		//{
		//	tmp += fact[A[i]];
		//}
		//tmp -= fact[N];
		//res += tmp;
		out << 5  << endl;
	}
	else {
		F res = N * log10(F( M ));
		fact[0] = 0;
		for (size_t i = 1; i <= N; i++)
		{
			fact[i] = fact[i-1] + log10(F( i ));
		}
		res -= fact[N];

		F tmp = 0;
		for (size_t i = 0; i < N; i++)
		{
			tmp += fact[A[i]];
		}
		res += tmp;
		out << static_cast<int64_t>(res) + 1 << endl;
	}

	return 0;
}
#endif

Submission Info

Submission Time
Task B - Theme Color
User eiya
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1826 Byte
Status
Exec Time 12 ms
Memory 2176 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 0 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt 12 ms 2176 KB
02.txt 9 ms 2048 KB
03.txt 12 ms 2176 KB
04.txt 8 ms 1664 KB
05.txt 6 ms 1792 KB
06.txt 6 ms 1792 KB
07.txt 6 ms 1792 KB
08.txt 7 ms 640 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB