結果
| 問題 | No.1734 Decreasing Elements | 
| コンテスト | |
| ユーザー |  platinum | 
| 提出日時 | 2021-08-19 08:48:22 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 784 bytes | 
| コンパイル時間 | 2,196 ms | 
| コンパイル使用メモリ | 202,024 KB | 
| 最終ジャッジ日時 | 2025-01-23 22:59:50 | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 20 WA * 3 TLE * 1 | 
ソースコード
#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];
	vector<int> B = A;
	sort(B.begin(), B.end());
	B.erase(unique(B.begin(), B.end()), B.end());
	int siz = B.size();
	vector<int> C = A;
	sort(C.begin(), C.end());
	if(C == A){
		cout << siz << endl;
		return 0;
	}
	sort(C.begin(), C.end(), greater<int>());
	if(C == A){
		cout << siz << endl;
		return 0;
	}
	int ans = 0;
	rep(i,N){
		int a = A[i];
		if(a == 0) continue;
		ans++;
		for(int j = i; j < N; j++){
			if(A[j] >= a) A[j] -= a;
		}
	}
	cout << ans << endl;
	return 0;
}
            
            
            
        