結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2020-01-09 13:44:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 1,700 ms |
| コンパイル使用メモリ | 175,384 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 03:51:17 |
| 合計ジャッジ時間 | 3,754 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
signed main(){
int n; cin >> n;
vector<pair<int, int>> a(n);
for(int i = 0; i < n; i++){
cin >> a[i].first;
a[i].second = i;
}
sort(a.rbegin(),a.rend());
int cnt = 0, res = a[0].second;
for(auto p : a){
if(res >= p.second){
cnt++;
res = p.second;
}else{
break;
}
}
cout << n - cnt << endl;
return 0;
}
oxyshower