제출 #1130623

#제출 시각아이디문제언어결과실행 시간메모리
1130623lopkusBaloni (COCI15_baloni)C++20
0 / 100
178 ms16916 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int cmp(pair<int,int> a, pair<int,int> b) { if(a.first > b.first) { return 1; } if(a.first == b.first) { if(a.second < b.second) { return 1; } } return 0; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<int,int>> V; for(int i = 1; i <= n; i++) { int a; cin >> a; V.push_back({a, i}); } sort(V.begin(), V.end(), cmp); int ans = 1; for(int i = 1; i < V.size(); i++) { if(V[i].second < V[i - 1].second) { ans += 1; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...