結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-07-18 03:36:39 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 485 bytes | 
| コンパイル時間 | 1,707 ms | 
| コンパイル使用メモリ | 196,364 KB | 
| 最終ジャッジ日時 | 2025-01-23 03:06:34 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 25 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, t;
	vector <int> v, lis;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> t;
		v.push_back(t);
	}
	lis.push_back(v[0]);
	for (int i = 1; i < n; i++)
	{
		if (lis.back() < v[i])
		{
			lis.push_back(v[i]);
		}
		else
		{
			auto it = lower_bound(lis.begin(), lis.end(), v[i]);
			*it = v[i];
		}
	}
	int res = n - lis.size();
	cout << res << '\n';
	return 0;
}
            
            
            
        