結果
| 問題 | No.1734 Decreasing Elements | 
| コンテスト | |
| ユーザー |  platinum | 
| 提出日時 | 2021-08-21 09:30:36 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 567 bytes | 
| コンパイル時間 | 1,901 ms | 
| コンパイル使用メモリ | 194,568 KB | 
| 最終ジャッジ日時 | 2025-01-24 01:16:53 | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 TLE * 5 | 
ソースコード
#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;
}
            
            
            
        