結果

問題 No.921 ずんだアロー
ユーザー watasihakodamawatasihakodama
提出日時 2019-11-08 22:30:37
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,202 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 141,736 KB
実行使用メモリ 75,264 KB
最終ジャッジ日時 2024-05-07 19:56:25
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
73,856 KB
testcase_01 AC 53 ms
73,984 KB
testcase_02 AC 54 ms
73,984 KB
testcase_03 AC 54 ms
73,984 KB
testcase_04 AC 54 ms
73,984 KB
testcase_05 AC 52 ms
73,984 KB
testcase_06 AC 53 ms
73,984 KB
testcase_07 AC 52 ms
73,856 KB
testcase_08 AC 53 ms
73,984 KB
testcase_09 AC 53 ms
73,984 KB
testcase_10 AC 61 ms
75,136 KB
testcase_11 AC 61 ms
75,136 KB
testcase_12 AC 53 ms
73,984 KB
testcase_13 AC 60 ms
74,752 KB
testcase_14 AC 61 ms
75,008 KB
testcase_15 AC 57 ms
74,368 KB
testcase_16 AC 52 ms
73,984 KB
testcase_17 AC 59 ms
75,136 KB
testcase_18 AC 62 ms
75,264 KB
testcase_19 AC 60 ms
75,264 KB
testcase_20 AC 61 ms
75,264 KB
testcase_21 AC 60 ms
75,264 KB
testcase_22 AC 62 ms
75,264 KB
testcase_23 AC 60 ms
75,264 KB
testcase_24 AC 60 ms
75,264 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