Submission #292359

#TimeUsernameProblemLanguageResultExecution timeMemory
292359MilosMilutinovicBaloni (COCI15_baloni)C++14
100 / 100
303 ms4088 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; scanf("%i",&n); int a[n]; for(int i=0;i<n;i++)scanf("%i",&a[i]); int ans=0; map<int,int> mp; for(int i=0;i<n;i++){ if(!mp[a[i]+1])ans++; else mp[a[i]+1]--; mp[a[i]]++; } printf("%i",ans); return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
baloni.cpp:7:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     for(int i=0;i<n;i++)scanf("%i",&a[i]);
      |                         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...