답안 #541731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541731 2022-03-24T09:39:52 Z FazacasMihai Baloni (COCI15_baloni) C++14
0 / 100
32 ms 1188 KB
#include <bits/stdc++.h>

using namespace std;

int v[100005], v2[100005];

int main()
{
    int n, k = 1, i, j;
    bool ok;
    cin>>n;
    for(i = 1; i <= n; i++)
    {
        cin>>v[i];
    }
    v2[k] = v[1];
    for(i = 2; i <= n; i++)
    {
        ok = 0;
        for(j = 1; j <= k; j++)
        {
            if(v[i] == v2[j] - 1)
            {
                v2[j]--;
                ok = 1;
            }
        }
        if(ok != 1)
        {
            k++;
            v2[k] = v[i];
        }
    }
    cout<<k;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 212 KB Output isn't correct
2 Incorrect 3 ms 440 KB Output isn't correct
3 Incorrect 5 ms 212 KB Output isn't correct
4 Incorrect 7 ms 340 KB Output isn't correct
5 Runtime error 32 ms 1100 KB Execution killed with signal 11
6 Runtime error 21 ms 1128 KB Execution killed with signal 11
7 Runtime error 20 ms 1188 KB Execution killed with signal 11
8 Runtime error 19 ms 1164 KB Execution killed with signal 11
9 Runtime error 21 ms 1152 KB Execution killed with signal 11
10 Runtime error 22 ms 1080 KB Execution killed with signal 11