Submission #382936

#TimeUsernameProblemLanguageResultExecution timeMemory
382936IwanttobreakfreeBaloni (COCI15_baloni)C++17
100 / 100
544 ms492 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); 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; break; } } } 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:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int j=0;j<v.size();j++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...