Submission #1134037


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>

#define in std::cin
#define out std::cout

constexpr uint64_t MOD = 1'000'000'007;
int32_t N;
int32_t X[100000];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	//入力
	in >> N;
	for (int32_t i = 0; i < N; ++i)
	{
		in >> X[i];
	}

	uint64_t result = 1;//答えの通り数
	int32_t num_ON = 0;//既に数直線上においてあるロボットの個数
	//全てを奇数座標に
	for (int32_t i = 0; i < N; ++i)
	{
		++num_ON;
		auto standable = (X[i] + 1) / 2;//数直線上の奇数座標の数
		if (standable < num_ON) {
			//埋まっている=>どれかをゴールさせる
			result *= num_ON;
			result %= MOD;
			--num_ON;
		}
	}
	//残りを好きな順番でゴールさせる
	do{
		result *= num_ON;
		result %= MOD;
	}while (--num_ON);
	out << result << std::endl;

	return 0;
}
#endif

Submission Info

Submission Time
Task A - Robot Racing
User eiya
Language C++14 (Clang 3.8.0)
Score 900
Code Size 1258 Byte
Status
Exec Time 112 ms
Memory 640 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
Subtask 500 / 500 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt
All 400 / 400 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
0_03.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 1 ms 256 KB
1_03.txt 1 ms 256 KB
1_04.txt 1 ms 256 KB
1_05.txt 1 ms 256 KB
1_06.txt 1 ms 256 KB
1_07.txt 1 ms 256 KB
1_08.txt 1 ms 256 KB
1_09.txt 1 ms 256 KB
1_10.txt 1 ms 256 KB
2_00.txt 78 ms 640 KB
2_01.txt 81 ms 640 KB
2_02.txt 109 ms 640 KB
2_03.txt 81 ms 640 KB
2_04.txt 81 ms 640 KB
2_05.txt 81 ms 640 KB
2_06.txt 81 ms 640 KB
2_07.txt 82 ms 640 KB
2_08.txt 81 ms 640 KB
2_09.txt 81 ms 640 KB
2_10.txt 81 ms 640 KB
2_11.txt 108 ms 640 KB
2_12.txt 112 ms 640 KB