結果

問題 No.1734 Decreasing Elements
ユーザー 👑 platinumplatinum
提出日時 2021-08-21 09:30:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 567 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 195,856 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-24 04:51:43
合計ジャッジ時間 7,780 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,984 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 22 ms
5,376 KB
testcase_08 AC 21 ms
5,376 KB
testcase_09 AC 18 ms
5,376 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 34 ms
5,376 KB
testcase_12 AC 23 ms
5,376 KB
testcase_13 AC 34 ms
5,376 KB
testcase_14 AC 78 ms
5,376 KB
testcase_15 AC 56 ms
5,376 KB
testcase_16 AC 78 ms
5,376 KB
testcase_17 AC 89 ms
5,376 KB
testcase_18 AC 92 ms
5,376 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;
using vv = vector<vector<int>>;
const int INF = (int)1e9;
const LL LINF = (LL)1e18;

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	int M = 0;
	rep(i,N) M = max(M, A[i]);
	vector<int> dp(M + 1);
	rep(i,M) dp[i+1] = i + 1;
	int ans = N;
	rep(i,N){
		int K = dp[A[i]];
		if(K == 0){
			ans--;
			continue;
		}
		rep(j,M+1){
			if(dp[j] >= K) dp[j] -= K;
		}
	}
	cout << ans << endl;

	return 0;
}
0