結果
問題 | No.365 ジェンガソート |
ユーザー |
|
提出日時 | 2020-10-15 23:16:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 194,088 KB |
最終ジャッジ日時 | 2025-01-15 07:42:20 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for(int i=0;i<n;i++){ cin >> a[i]; } reverse(a.begin(), a.end()); int cnt=0; int cur=n; for(int i=0;i<n;i++){ if(a[i]==cur){ cnt++; cur--; } } cout << n-cnt << endl; }