結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2022-03-17 21:20:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 1,877 ms |
コンパイル使用メモリ | 194,568 KB |
最終ジャッジ日時 | 2025-01-28 10:04:56 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; vector<int> A(N); for (auto &&a : A) { cin >> a; } auto it = find(A.begin(), A.end(), N); int ans = N - 1; while (it != A.begin()) { it = prev(it); if (*it == ans) { ans--; } } cout << ans << endl; }