Submission #709029

#TimeUsernameProblemLanguageResultExecution timeMemory
709029vjudge1Baloni (COCI15_baloni)C++17
40 / 100
2093 ms4696 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define sc second #define pb(x) push_back(x) #define ll long long #define sp ' ' #define pairs pair<int, int> #define mp make_pair void show(vector <int> v){ for(int i=0; i<v.size(); i++){ cout<<v[i]<<sp; } cout<<endl; } int main(){ int n,cnt=0; cin>>n; vector <int> v; for(int i=0; i<n; i++){ int h; cin>>h; v.pb(h); } while(v.size()>0){ int h1=v[0]-1; for(int j=1; j<v.size(); j++){ if(v[j]==h1){ v.erase(v.begin()+j); j--; h1--; } } v.erase(v.begin()); cnt++; } cout<<cnt; return 0; }

Compilation message (stderr)

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