# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1153961 | salmon | Po (COCI21_po) | C++20 | 8 ms | 1092 KiB |
#include <bits/stdc++.h>
using namespace std;
int N;
int lst[100100];
vector<int> b;
int main(){
scanf(" %d",&N);
for(int i = 0; i < N; i++){
scanf(" %d",&lst[i]);
}
int cont = 0;
for(int i = 0; i < N; i++){
while(!b.empty() && b.back() > lst[i]){
b.pop_back();
cont++;
}
if(b.empty() || b.back() != lst[i]) b.push_back(lst[i]);
}
cont += b.size();
printf("%d\n",cont);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |