結果
問題 | No.365 ジェンガソート |
ユーザー | btk |
提出日時 | 2016-04-22 13:36:27 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 428 bytes |
コンパイル時間 | 1,480 ms |
コンパイル使用メモリ | 159,332 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 01:32:11 |
合計ジャッジ時間 | 3,050 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N;assert(1 <= N && N <= 100000); vector<int> a(N); vector<int> cnt(N + 1,-1); for(auto& it : a){ cin >> it; assert(1 <= it && it <= N); cnt[it] = 0; } cnt[0] = 0; for(auto& it : cnt)assert(it == 0); for(auto& it : a)cnt[it] = cnt[it - 1] + 1; cout << N-cnt[N] << endl; return 0; }