結果
| 問題 |
No.1438 Broken Drawers
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2021-03-26 21:42:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 81 ms / 2,000 ms |
| コード長 | 552 bytes |
| コンパイル時間 | 2,782 ms |
| コンパイル使用メモリ | 174,032 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-28 22:25:42 |
| 合計ジャッジ時間 | 4,350 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 50
#define MOD 1000000007
#define INF 1000000000
int main(){
int N;
cin>>N;
vector<pair<int,int>> A(N);
for(int i=0;i<N;i++){
cin>>A[i].first;
A[i].second=i;
}
sort(A.begin(),A.end());
vector<bool> opend(N+1,false);
int ans=0;
for(int i=0;i<N;i++){
if(opend[A[i].second+1]==false){
ans++;
opend[A[i].second]=true;
}
}
cout<<ans<<endl;
}
monnu