답안 #541757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541757 2022-03-24T09:58:27 Z nutzu Baloni (COCI15_baloni) C++11
100 / 100
174 ms 7188 KB
#include <iostream>

using namespace std;
long long n,i,s=0,x,x1,v[1000001];
long long  v1[1000001];
int main()
{
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>v[i];
    }
    for(i=1; i<=n; i++)
    {
        if(v1[v[i]]>0)
        {
            v1[v[i]]--;
            v1[v[i]-1]++;
        }
        else
        {
            s++;
            v1[v[i]-1]++;
        }
        //cout << s << " " << v1[v[i]] << " " << v1[v[i]-1] << "\n";
    }
    cout<<s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 170 ms 6392 KB Output is correct
6 Correct 174 ms 7188 KB Output is correct
7 Correct 174 ms 5948 KB Output is correct
8 Correct 155 ms 5960 KB Output is correct
9 Correct 162 ms 6348 KB Output is correct
10 Correct 154 ms 6452 KB Output is correct