Submission #229420

#TimeUsernameProblemLanguageResultExecution timeMemory
229420DodgeBallManBaloni (COCI15_baloni)C++14
100 / 100
122 ms7332 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1e6 + 10;
int n, h[N], arrow[N], tot = 0;
 
int main()
{
    scanf("%d",&n);
	for ( int i = 1 ; i <= n ; i++ ){
		scanf("%d",&h[i]);
		if( !arrow[h[i]] ) {
			tot++;
			arrow[h[i]-1]++;
		}
		else {
			arrow[h[i]]--;
			arrow[h[i]-1]++;
		}
	}
    printf("%d",tot);
}

Compilation message (stderr)

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