結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2020-01-09 13:33:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 1,812 ms |
コンパイル使用メモリ | 175,184 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-23 03:51:13 |
合計ジャッジ時間 | 4,537 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 25 |
ソースコード
#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 ans = 0, left = a[0].second; for(auto p : a){ if(left < p.second){ ans++; }else{ left = p.second; } } cout << ans << endl; return 0; }