Submission #1112380

#TimeUsernameProblemLanguageResultExecution timeMemory
1112380vjudge1Baloni (COCI15_baloni)C++17
0 / 100
2083 ms6584 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int say=0; vector<int> a; for(int i=0;i<n;i++){ int x;cin>>x; a.push_back(x); } int mx=*max_element(a.begin(),a.end()); for(int i=0;a[i]!=-1;i){ say++; int q=1; for(int j=i+1;j<n;j++){ if(a[j]==mx-q){ q++; a[j]=-1; } } a[i]=-1; i++; } cout<<say-1; return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:13:23: warning: for increment expression has no effect [-Wunused-value]
   13 |  for(int i=0;a[i]!=-1;i){
      |                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...