답안 #165816

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165816 2019-11-29T08:14:33 Z ArKCa Baloni (COCI15_baloni) C++17
100 / 100
111 ms 7288 KB
#include<bits/stdc++.h>
#define ll long long 
#define mod 1000000007
#define pb push_back
#define pob pop_back
#define N 1000006
#define x dizi[i]
using namespace std;

int v[N];
int n,a;
int dizi[N];
ll ans;
int main(){
	// freopen("a.gir","r",stdin);
	// freopen("a.cik","w",stdout);
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&dizi[i]);
	}
	for(int i=(n-1);i>=0;i--){
		v[x]++;
		if(v[(x)-1]==0){
			ans++;
		}
		else{
			v[(x)-1]--;
		}
	}
	printf("%lld\n", ans);
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
baloni.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&dizi[i]);
   ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 105 ms 7108 KB Output is correct
6 Correct 111 ms 7288 KB Output is correct
7 Correct 90 ms 6024 KB Output is correct
8 Correct 89 ms 6004 KB Output is correct
9 Correct 99 ms 6548 KB Output is correct
10 Correct 98 ms 6520 KB Output is correct