結果
問題 | No.1438 Broken Drawers |
ユーザー |
![]() |
提出日時 | 2021-03-26 21:30:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 179 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 1,855 ms |
コンパイル使用メモリ | 177,848 KB |
実行使用メモリ | 14,208 KB |
最終ジャッジ日時 | 2024-11-28 22:03:45 |
合計ジャッジ時間 | 5,850 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> // #include<atcoder/all> // #include<boost/multiprecision/cpp_int.hpp> using namespace std; // using namespace atcoder; // using bint = boost::multiprecision::cpp_int; using ll = long long; using ull = unsigned long long; using P = pair<int,int>; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define MOD 1000000007 int main(){ int n; cin >> n; vector<P> a(n); rep(i,n)cin >> a[i].first,a[i].second = i; sort(ALL(a)); set<int> st; int res = 0; rep(i,n){ if(st.count(a[i].second+1))continue; res++; st.insert(a[i].second); } cout << res << "\n"; return 0; }