답안 #740039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740039 2023-05-12T02:21:02 Z mzv Baloni (COCI15_baloni) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'

using namespace std;

/* ------------------------ hi lol ------------------------ */

// author : mzv

int n,x,arrow[1'000'000],ans=0;

int main() {
	ccd
	memset(arr,0,sizeof(arr));
	cin >> n;
	for (int i=1;i<=n;i++) {
		cin >> x;
		if (arrow[x]>0) {
			arrow[x]--; // ad arrow tinggi x, langsung meledak
		}
		arrow[x-1]++; // balon ke x kena, arrow jatuh ke x-1
	}
	for (int i=0;i<=n;i++) {
		ans += arrow[i];
	}
	cout << ans << endl;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:17:9: error: 'arr' was not declared in this scope
   17 |  memset(arr,0,sizeof(arr));
      |         ^~~