Mujin Programming Challenge 2017

Submission #1555706

Source codeソースコード

#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	ll res=1;
	int I=0,num=0,b=0;
	while(I<n){
		num++;
		if(b||num>a[I]/2+1){
			I--;
			num--;
			(res*=num)%=mod;
			num--;
			b=-1;
		}
		if(b==0&&a[I]%2==0&&a[I]/2+1==num) b=1;
		else b=0;
		I++;
	}
	for(int i=1;i<=num;i++) (res*=i)%=mod;
	cout<<res<<endl;
}

Submission

Task問題 A - Robot Racing
User nameユーザ名 MAK
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 900
Source lengthソースコード長 1466 Byte
File nameファイル名
Exec time実行時間 55 ms
Memory usageメモリ使用量 640 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
0_02.txt AC 1 ms 256 KB
0_03.txt AC 1 ms 256 KB
1_00.txt AC 1 ms 256 KB
1_01.txt AC 1 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt AC 1 ms 256 KB
1_05.txt AC 1 ms 256 KB
1_06.txt AC 1 ms 256 KB
1_07.txt AC 1 ms 256 KB
1_08.txt AC 1 ms 256 KB
1_09.txt AC 1 ms 256 KB
1_10.txt AC 1 ms 256 KB
2_00.txt AC 36 ms 640 KB
2_01.txt AC 39 ms 640 KB
2_02.txt AC 55 ms 640 KB
2_03.txt AC 38 ms 640 KB
2_04.txt AC 38 ms 640 KB
2_05.txt AC 39 ms 640 KB
2_06.txt AC 39 ms 640 KB
2_07.txt AC 39 ms 640 KB
2_08.txt AC 39 ms 640 KB
2_09.txt AC 39 ms 640 KB
2_10.txt AC 39 ms 640 KB
2_11.txt AC 53 ms 640 KB
2_12.txt AC 54 ms 640 KB