結果
問題 |
No.1438 Broken Drawers
|
ユーザー |
![]() |
提出日時 | 2023-06-19 17:07:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 1,797 ms |
コンパイル使用メモリ | 196,608 KB |
最終ジャッジ日時 | 2025-02-14 22:58:19 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int ans=0, N, A; cin >> N; vector<int> P(N); for (int i=0; i<N; i++){ cin >> A; A--; P[A] = i; } vector<bool> used(N+1); for (int i=0; i<N; i++){ if (!used[P[i]+1]){ ans++; used[P[i]] = 1; } } cout << ans << endl; return 0; }