답안 #132786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132786 2019-07-19T14:33:48 Z Vardanyan Baloni (COCI15_baloni) C++14
100 / 100
126 ms 28536 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1000*1000+5;
int a[N];
bool col[N];
vector<int> mark[N];
int main(){
    ios_base::sync_with_stdio(false);
    int n;
   // cout<<0<<endl;
    cin>>n;
    for(int i = 1;i<=n;i++) cin>>a[i];
    int ans = 0;

    for(int i = 1;i<=n;i++){
        int x = a[i];
        if(mark[x+1].size() == 0){
            mark[x].push_back(i);
            ans++;
            continue;
        }
        mark[x+1].pop_back();
        mark[x].push_back(i);
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23800 KB Output is correct
2 Correct 24 ms 23800 KB Output is correct
3 Correct 25 ms 23928 KB Output is correct
4 Correct 25 ms 23928 KB Output is correct
5 Correct 126 ms 28252 KB Output is correct
6 Correct 118 ms 28536 KB Output is correct
7 Correct 101 ms 28152 KB Output is correct
8 Correct 99 ms 28152 KB Output is correct
9 Correct 125 ms 28152 KB Output is correct
10 Correct 109 ms 28472 KB Output is correct