結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー e869120
提出日時 2021-03-12 21:42:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 82,972 KB
実行使用メモリ 7,120 KB
最終ジャッジ日時 2024-10-14 11:59:18
合計ジャッジ時間 4,127 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

long long N, X[1 << 18];
long long B[1 << 18], cnt;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> X[i];
	for (int i = 0; i < N; i++) X[i] = (1000000LL * X[i]) + 1LL * i;
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(B, B + cnt, X[i]) - B;
		if (pos1 == cnt) cnt++;
		B[pos1] = X[i];
	}
	cout << N - cnt << endl;
	return 0;
}
0