結果
問題 | No.365 ジェンガソート |
ユーザー |
|
提出日時 | 2016-05-09 16:31:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 461 ms |
コンパイル使用メモリ | 61,600 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 02:15:07 |
合計ジャッジ時間 | 1,831 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> vec(n); for (auto& i : vec) { cin >> i; } int ans = n; for (int i = n - 1; i >= 0; --i) { if (vec.at(i) == ans) --ans; } cout << ans << endl; return 0; }