Submission #533496

#TimeUsernameProblemLanguageResultExecution timeMemory
533496devariaotaMoney (IZhO17_money)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; int n; set<int> sim; int ans = 1; int arr[1000005]; int main(){ cin >> n; for(int i=1;i<n;i++){ cin >> arr[i]; } int batas = 1000000000; for(int i=1;i<n;i++){ if(i != 0 && (arr[i] < arr[i-1] || arr[i] > batas)){ ans++; set<int>::iterator it = sim.upper_bound(arr[i]); if(it == sim.end()){ batas = 1000000000; }else{ batas = *it; } } sim.insert(arr[i]); } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...