結果
問題 | No.1438 Broken Drawers |
ユーザー | Haa |
提出日時 | 2021-03-26 21:31:14 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 1,404 ms |
コンパイル使用メモリ | 172,928 KB |
実行使用メモリ | 9,696 KB |
最終ジャッジ日時 | 2023-08-19 07:32:50 |
合計ジャッジ時間 | 3,787 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | WA | - |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | WA | - |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 57 ms
9,364 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 41 ms
6,744 KB |
testcase_14 | WA | - |
testcase_15 | AC | 67 ms
8,828 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 68 ms
9,092 KB |
testcase_21 | WA | - |
testcase_22 | AC | 69 ms
9,320 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll,ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=998244353; constexpr ll INF=2e18; int main(){ int n; cin >> n; VI a(n); REP(i,n) cin >> a[i]; vector<P> p(n); REP(i,n) p[i]={a[i],i}; sort(ALL(p)); VI f(n,0); int ans=0; REP(i,n){ if(i==n-1||!f[p[i].second+1]){ ans++; f[p[i].second]=1; } } cout << ans << endl; return 0; }