結果

問題 No.2055 12x34...
ユーザー warabi0906warabi0906
提出日時 2023-02-28 19:05:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,384 bytes
コンパイル時間 4,342 ms
コンパイル使用メモリ 235,040 KB
実行使用メモリ 26,580 KB
最終ジャッジ日時 2023-10-14 01:57:30
合計ジャッジ時間 11,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 149 ms
16,996 KB
testcase_13 AC 270 ms
25,524 KB
testcase_14 AC 95 ms
12,332 KB
testcase_15 AC 93 ms
12,544 KB
testcase_16 AC 289 ms
26,580 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include "atcoder/all"
#define debug cout << "OK" << endl;
template<typename T>
inline bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
inline bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }
inline int Code(char c) {
	if ('A' <= c and c <= 'Z')return (int)(c - 'A');
	if ('a' <= c and c <= 'z')return (int)(c - 'a');
	if ('0' <= c and c <= '9')return (int)(c - '0');
	assert(false);
}
inline long long sigma(const long long begin, const long long end, const long long mod = (1LL << 60)) {
	long long t = (begin + end) % mod;
	long long l = (end - begin + 1) % mod;
	return (t * l / 2) % mod;
}
using namespace std;
using namespace atcoder;
using minit = modint1000000007;
constexpr int MOD = 1000000007;
constexpr int MOD2 = 998244353;
constexpr long long INF = 1e18;

template<typename T>
ostream& operator << (ostream& st, const vector<T>& v) {
	for (const T value : v) {
		st << value << " ";
	}
	return st;
}
template<typename T>
istream& operator >> (istream& st, vector<T>& v) {
	for (T& value : v) {
		st >> value;
	}
	return st;
}

long long pow_(const long long a, const long long b, const long long m = INF) {
	long long res = 1;
	long long base = a;
	for (int i = 0; i < 64; i++) {
		if (b & (1ll << i))res *= base;
		res %= m;
		base = base * base;
		base %= m;
	}
	return res;
}
inline int gcd(const int a, const int b) { return (b == 0 ? a : gcd(b, a % b)); }
inline int lcm(const int a, const int b) { return a * b / gcd(a, b); }
//
int Div(int a, int b, int m) {
	return (a * pow_(b, m - 2, m)) % m;
}
class nCk {
public:
	vector<long long> fact, fact_inv, inv;
	long long m;
	/*  init_nCk :二項係数のための前処理
		計算量:O(n)
	*/
	void init_nCk(int SIZE,int mod) {
		m = mod;
		fact.resize(SIZE + 5);
		fact_inv.resize(SIZE + 5);
		inv.resize(SIZE + 5);
		fact[0] = fact[1] = 1;
		fact_inv[0] = fact_inv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < SIZE + 5; i++) {
			fact[i] = fact[i - 1] * i % m;
			inv[i] = m - inv[m % i] * (m / i) % m;
			fact_inv[i] = fact_inv[i - 1] * inv[i] % m;
		}
	}
	/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
		計算量:O(1)
	*/
	long long com(int n, int k) {
		assert(!(n < k));
		assert(!(n < 0 || k < 0));
		return fact[n] * (fact_inv[k] * fact_inv[n - k] % m) % m;
	}
};
//

class Solver {
public:
	int T;
	Solver() :T(1) {}
	~Solver(){}
	void ios()const;
	void multi();
	void solve() const;
	void sp(int x)const;
	void ft()const;

	//
	
	//
};
void Solver::ios() const {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	return;
}
void Solver::multi() {
	cin >> T;
	return;
}
void Solver::sp(const int x)const {
	cout << fixed << setprecision(x) << endl;
	return;
}

void Solver::ft() const {
	
}
void Solver::solve() const {
	long long N;
	cin >> N;
	vector<long long> A(N);
	for (long long& a : A)cin >> a;
	map<long long, long long> mp;
	for (const int a : A) {
		mp[a]++;
		mp[a] += mp[a - 1];
	}
	long long ans = 0ll;
	for (pair<long long, long long> p : mp) {
		ans += p.second;
	}
	ans -= N;
	cout << ans << endl;
}

signed main() {
	Solver solver;
	solver.ios();
	//solver.ft();
	//solver.multi();
	//solver.sp();
	for (int i = 0; i < solver.T; i++)
		solver.solve();
	return 0;
}

/*
* わらびのコードこーどすぺーす
 (σ・∀・)σゲッツ!!
*/
0