답안 #319661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
319661 2020-11-06T03:38:48 Z ignaciocanta Baloni (COCI15_baloni) C++14
100 / 100
218 ms 8036 KB
#include <bits/stdc++.h>

using namespace std;

#define forsn(i, s, n) for(int i=s;i<int(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define NACHO ios_base::sync_with_stdio(0);cin.tie(NULL);

typedef long long tint;

int main(){
   int n; cin >> n;
   vector<int> a (n);
   forn(i, n) cin >> a[i];
   vector<int> visited (1000002, 0);
   vector<bool> tiene (n, 0);
   forn(i, n){
       visited[a[i]]++;
       if(visited[a[i]+1]){ tiene[i] = 1; visited[a[i]+1]--;}
   }
   int cont = 0;
   forn(i, n){
       if(tiene[i] == 0) cont++;
   }
   cout << cont << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4204 KB Output is correct
2 Correct 3 ms 4204 KB Output is correct
3 Correct 4 ms 4204 KB Output is correct
4 Correct 4 ms 4204 KB Output is correct
5 Correct 209 ms 7524 KB Output is correct
6 Correct 218 ms 8036 KB Output is correct
7 Correct 178 ms 7140 KB Output is correct
8 Correct 171 ms 7140 KB Output is correct
9 Correct 194 ms 7396 KB Output is correct
10 Correct 192 ms 7396 KB Output is correct