結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2016-04-29 22:48:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 451 ms |
コンパイル使用メモリ | 56,776 KB |
実行使用メモリ | 10,532 KB |
最終ジャッジ日時 | 2024-10-04 18:27:32 |
合計ジャッジ時間 | 4,171 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 6 TLE * 1 -- * 24 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; #define MAX_n 100000+10 int n; int a[MAX_n]; int dp[MAX_n]; int main() { cin>>n; int ans=0; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n;i++) { dp[i]=1; for(int j=0;j<i;j++) if(a[j]<a[i]) { dp[i]=max(dp[i],dp[j]+1); } ans=max(ans,dp[i]); } cout<<n-ans<<endl; }