답안 #120034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120034 2019-06-23T05:38:29 Z Clementime Baloni (COCI15_baloni) C++17
0 / 100
204 ms 18808 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define FOR(i, l, r) for(ll i = l; i <= r; i++)
const ll MAX = 1000005;
ll a[MAX], dp[MAX];
bool used[MAX];

int main(){
	ll n; cin >> n;
	memset(used, false, sizeof used);
	FOR(i, 1, n){
		cin >> a[i];
	}
	dp[1] = 1; used[a[1]] = true;
	FOR(i, 2, n){
		if(used[a[i] + 1]) dp[i] = dp[i - 1];
		else dp[i] = dp[i - 1] + 1;
		used[a[i]] = true;
	}
	cout << dp[n];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1408 KB Output isn't correct
2 Incorrect 4 ms 1280 KB Output isn't correct
3 Incorrect 4 ms 1408 KB Output isn't correct
4 Incorrect 5 ms 1408 KB Output isn't correct
5 Incorrect 199 ms 17272 KB Output isn't correct
6 Incorrect 204 ms 18808 KB Output isn't correct
7 Incorrect 163 ms 15864 KB Output isn't correct
8 Incorrect 161 ms 15480 KB Output isn't correct
9 Incorrect 186 ms 16504 KB Output isn't correct
10 Incorrect 180 ms 17024 KB Output isn't correct