Submission #40702

#TimeUsernameProblemLanguageResultExecution timeMemory
40702HassoonyBaloni (COCI15_baloni)C++14
0 / 100
340 ms19904 KiB
#include <stdio.h> #include <stdlib.h> #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=1e6+9; int n,a[MX],ans,x; set<int>s; int main(){ cin>>n; for(int i=0;i<n;i++){ scanf("%d",&x); if(s.find(x)!=s.end()){ s.erase(s.find(x)); --x;if(x<=0)continue; s.insert(x); continue; } s.insert(x-1);ans++; } cout<<ans<<endl; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:15:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...