結果

問題 No.921 ずんだアロー
ユーザー watasihakodamawatasihakodama
提出日時 2019-11-08 22:30:38
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 1,202 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 106,432 KB
実行使用メモリ 75,188 KB
最終ジャッジ日時 2023-08-20 13:25:24
合計ジャッジ時間 3,692 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
74,004 KB
testcase_01 AC 53 ms
74,016 KB
testcase_02 AC 53 ms
73,980 KB
testcase_03 AC 53 ms
74,032 KB
testcase_04 AC 54 ms
74,004 KB
testcase_05 AC 52 ms
73,996 KB
testcase_06 AC 52 ms
74,044 KB
testcase_07 AC 52 ms
74,004 KB
testcase_08 AC 52 ms
74,008 KB
testcase_09 AC 53 ms
74,000 KB
testcase_10 AC 62 ms
75,152 KB
testcase_11 AC 63 ms
75,188 KB
testcase_12 AC 56 ms
74,032 KB
testcase_13 AC 60 ms
74,684 KB
testcase_14 AC 60 ms
74,852 KB
testcase_15 AC 57 ms
74,324 KB
testcase_16 AC 53 ms
74,132 KB
testcase_17 AC 61 ms
74,860 KB
testcase_18 AC 61 ms
75,136 KB
testcase_19 AC 62 ms
75,144 KB
testcase_20 AC 62 ms
75,084 KB
testcase_21 AC 61 ms
75,080 KB
testcase_22 AC 62 ms
75,120 KB
testcase_23 AC 62 ms
75,140 KB
testcase_24 AC 62 ms
75,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll N;
vector<double>p(3002);
vector<vector<double>>memo(3002,vector<double>(3002,-1));
double f(double i,double j){
	if(memo[i][j]!=-1)return memo[i][j];
	if(i==0){
		if(j==0)return 1;
		else return 0;
	}
	return memo[i][j]=(1-p[i-1])*f(i-1,j)+p[i-1]*f(i-1,j-1);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N;
	cin>>N;
	vector<ll>A(N);
	ll ans=0;
	for(int i=0;i<N;i++)cin>>A[i];
	
	A.push_back(-1);
	for(int i=0;i<N;i++){
		if(A[i]!=A[i+1])i++;
		ans++;
	}
	cout<<ans<<endl;
}
0