Submission #229420

# Submission time Handle Problem Language Result Execution time Memory
229420 2020-05-04T12:28:00 Z DodgeBallMan Baloni (COCI15_baloni) C++14
100 / 100
122 ms 7332 KB
#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

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 time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 122 ms 6956 KB Output is correct
6 Correct 121 ms 7332 KB Output is correct
7 Correct 91 ms 5984 KB Output is correct
8 Correct 88 ms 6016 KB Output is correct
9 Correct 102 ms 6520 KB Output is correct
10 Correct 110 ms 6624 KB Output is correct