답안 #644338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
644338 2022-09-24T11:41:20 Z Kripton Zalmoxis (BOI18_zalmoxis) C++14
30 / 100
131 ms 12424 KB
#include <bits/stdc++.h>
using namespace std;
int steve[1000001],vf;
int v[1000001],v1[1000001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,i,x;
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>v[i];
        v1[i]=v[i];
        while(v[i]==v[steve[vf]])
        {
            v[i]++;
            vf--;
        }
        steve[++vf]=i;
    }
    int ind,min1=40;
    for(i=1;i<=vf;i++)
        if(v[steve[i]]<min1)
        {
            min1=v[steve[i]];
            ind=steve[i];
        }
    for(i=1;i<=n;i++)
    {
        cout<<v1[i]<<" ";
        if(i==ind)
            cout<<min1<<" ";
    }
    return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:10:15: warning: unused variable 'x' [-Wunused-variable]
   10 |     int n,k,i,x;
      |               ^
zalmoxis.cpp:33:9: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |         if(i==ind)
      |         ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 126 ms 12304 KB Output is correct
2 Correct 122 ms 12240 KB Output is correct
3 Correct 127 ms 12316 KB Output is correct
4 Correct 121 ms 12196 KB Output is correct
5 Correct 128 ms 12248 KB Output is correct
6 Correct 121 ms 12236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 131 ms 12352 KB Unexpected end of file - int32 expected
2 Incorrect 126 ms 12256 KB Unexpected end of file - int32 expected
3 Incorrect 129 ms 12424 KB Unexpected end of file - int32 expected
4 Incorrect 121 ms 12252 KB Unexpected end of file - int32 expected
5 Incorrect 130 ms 12272 KB Unexpected end of file - int32 expected
6 Incorrect 122 ms 12292 KB Unexpected end of file - int32 expected
7 Incorrect 123 ms 12248 KB Unexpected end of file - int32 expected
8 Incorrect 123 ms 12324 KB Unexpected end of file - int32 expected
9 Incorrect 98 ms 11040 KB Unexpected end of file - int32 expected
10 Incorrect 36 ms 4680 KB Unexpected end of file - int32 expected
11 Incorrect 60 ms 7304 KB Unexpected end of file - int32 expected
12 Incorrect 1 ms 340 KB Unexpected end of file - int32 expected
13 Incorrect 0 ms 340 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 328 KB Unexpected end of file - int32 expected