| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 475183 | _L__ | Po (COCI21_po) | C++14 | 13 ms | 844 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// This code is written by _L__
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
using namespace std;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 2e5, inf = 1e11;
const ld E = 1e-6;
#define ff first
#define ss second
int main(void){
F_word;
int n; cin >> n; int a[n+1] = {};
for(int i = 1; i <= n; ++i) cin >> a[i];
stack<int> st;
st.push(0);
int ans = 0;
for(int i = 1; i <= n; ++i){
while(a[st.top()] > a[i]){
st.pop(); ++ans;
}
if(a[st.top()] < a[i]) st.push(i);
}
ans += st.size()-1;
cout << ans << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
