Submission #382934

#TimeUsernameProblemLanguageResultExecution timeMemory
382934IwanttobreakfreeBaloni (COCI15_baloni)C++17
0 / 100
2081 ms1092 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,h,num; cin>>n; vector<int> v; cin>>h; v.push_back(h); for(int i=1;i<n;i++){ cin>>num; bool pos=false; if(num<h){ for(int j=0;j<v.size();j++){ if(v[j]==num+1){ v[j]=num; pos=true; } } } if(!pos){ v.push_back(num); if(num>h)h=num; } } cout<<v.size(); }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int j=0;j<v.size();j++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...