Submission #382929

#TimeUsernameProblemLanguageResultExecution timeMemory
382929IwanttobreakfreeBaloni (COCI15_baloni)C++17
0 / 100
346 ms10856 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n; cin>>n; vector<pair<int,int> > v(n); for(int i=0;i<n;i++){ cin>>v[i].first; v[i].second=i; } sort(v.rbegin(),v.rend()); int cont=1; for(int i=1;i<n;i++){ if(v[i].first==v[i-1].first-1&&v[i].second>v[i-1].second)continue; else cont++; } cout<<cont<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...