답안 #1108079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108079 2024-11-02T17:15:34 Z vicvic Zalmoxis (BOI18_zalmoxis) C++11
0 / 100
2 ms 4432 KB
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("zalmoxis.in");
ofstream g ("zalmoxis.out");
int n, k, v[2000005], poz, added[2000005], s[2000005], cnt;
int main()
{
    f >> n >> k;
    int poz=0;
    for (int i=1;i<=n;i++)
    {
        int x;
        f >> x;
        int ok=0;
        while (cnt && s[cnt]<x)
        {
            v[++poz]=s[cnt]+ok;
            int val=v[poz];
            while (cnt && val==s[cnt])
            {
                cnt--;
                val++;
            }
            s[++cnt]=val;
            added[poz]=1;
            ok=1;
        }
        v[++poz]=x;
        while (cnt && x==s[cnt])
        {
            cnt--;
            x++;
        }
        s[++cnt]=x;
    }
    k-=poz;
    while (s[cnt]!=30)
    {
        v[++poz]=s[cnt];
        added[poz]=1;
        int val=v[poz];
        while (cnt && s[cnt]==val)
        {
            cnt--;
            val++;
        }
        s[++cnt]=val;
    }
    for (int i=1;i<=poz;i++)
    {
        if (added[poz] && k && v[i]>1)
        {
            int fp=max (v[i]-k, 1);
            int cate=min (v[i]-1, k);
            g << fp << " ";
            for (int j=fp;j<=v[i]-2;j++)
            {
                g << j << " ";
            }
            v[i]--;
            k-=cate;
            i--;
            continue;
        }
        g << v[i] << " ";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
2 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
3 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
4 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
5 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
2 Incorrect 2 ms 4432 KB Unexpected end of file - int32 expected
3 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
4 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
5 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
7 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
8 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
9 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
10 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
11 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
12 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected
14 Incorrect 1 ms 4432 KB Unexpected end of file - int32 expected