Submission #383291

#TimeUsernameProblemLanguageResultExecution timeMemory
383291victoriadBaloni (COCI15_baloni)C++14
100 / 100
539 ms6636 KiB
#include <fstream> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <utility> #include <queue> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; vector<bool>p(n,false); vector<int>b; int x=0; vector<int>a(n); for(int i=0;i<n;i++){ cin>>a[i]; } int y; b.push_back(a[0]-1); for(int i=1;i<n;i++){ if(p[i])continue; for(int j=0;j<b.size();j++){ if(a[i]==b[j]){ b[j]--; p[i]=true; break; } } if(!p[i]) b.push_back(a[i]-1); } cout<<b.size(); return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int j=0;j<b.size();j++){
      |                     ~^~~~~~~~~
baloni.cpp:17:9: warning: unused variable 'x' [-Wunused-variable]
   17 |     int x=0;
      |         ^
baloni.cpp:22:9: warning: unused variable 'y' [-Wunused-variable]
   22 |     int y;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...