結果
問題 | No.365 ジェンガソート |
ユーザー |
![]() |
提出日時 | 2016-04-30 01:10:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 707 bytes |
コンパイル時間 | 1,553 ms |
コンパイル使用メモリ | 167,368 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 01:53:41 |
合計ジャッジ時間 | 3,294 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define dump(c) cerr << "> " << #c << " = " << (c) << endl #define all(c) ((c).begin()), ((c).end()) #define rep(i, n) for(int i=0;i<(int)n;i++) #define FOR(i, s, e) for(int (i)=(int)(s);(i)<(int)(e);++(i)) #define inf 0x3f3f3f3f #define infl 0x3f3f3f3f3f3f3f3fLL typedef long long ll; typedef unsigned long long ull; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; ++i) cin >> a[i]; int count = 0; int d = N+1; for (int j = N-1; j >= 0; --j) { if (a[j] == d - 1) { count++; d = d - 1; } } cout << N - count << endl; return 0; }