Submission #467453

#TimeUsernameProblemLanguageResultExecution timeMemory
467453thiennnBaloni (COCI15_baloni)C++14
100 / 100
223 ms3856 KiB
#include <bits/stdc++.h> using namespace std; #define fasty ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define forinc(x,a,b) for(int x=a;x<=b;x++) #define ford(x,a,b) for(int x=a;x>=b;x--) #define forv(a,b) for(auto&a:b) #define fi first #define se second #define pb push_back #define ii pair<int,int> #define mt make_tuple #define all(a) a.begin(),a.end() #define reset(f,x) memset(f,x,sizeof(f)) #define getbit(x,i) ((x>>i)&1) #define batbit(x,i) (x|(1ll<<i)) #define tatbit(x,i) (x&~(1<<i)) #define gg exit(0); const int N = 1e6+10; int h[N]; int cnt[N]; int shoot; int n; main() { cin >> n; forinc(i,1,n) { int x; cin >> x; if(cnt[x] == 0) { cnt[x-1]++; shoot++; } else { cnt[x]--; cnt[x-1]++; } } cout << shoot; }

Compilation message (stderr)

baloni.cpp:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...