답안 #209837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209837 2020-03-15T17:16:33 Z nicolaalexandra Zalmoxis (BOI18_zalmoxis) C++14
30 / 100
329 ms 6392 KB
#include <bits/stdc++.h>
#define DIM 1000010
using namespace std;
int v[DIM];
int n,i,poz,sol,k,sol_poz,idx;

int solve (int val){

    if (v[idx] == val){ /// am deja valoarea pe care o caut
        idx++;
        return idx;
    }

    if (!val)
        return 0;

    /// stanga

    int poz = solve (val-1);

    if (poz > n || v[poz] > val-1){
        /// sunt obligata sa pun aici val
        sol = val-1;
        sol_poz = poz-1;

        return poz;
    }

    /// dreapta
    return solve (val-1);
}

int main (){

   // ifstream cin ("zalmoxis.in");
   // ofstream cout ("zalmoxis.out");

    cin>>n>>k;
    for (i=1;i<=n;i++)
        cin>>v[i];

    idx = 1;
    solve (30);

    for (i=1;i<=n;i++){
        cout<<v[i]<<" ";
        if (i == sol_poz)
            cout<<sol<<" ";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 6380 KB Output is correct
2 Correct 319 ms 6264 KB Output is correct
3 Correct 313 ms 6392 KB Output is correct
4 Correct 323 ms 6264 KB Output is correct
5 Correct 322 ms 6392 KB Output is correct
6 Correct 303 ms 6264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 308 ms 6264 KB Unexpected end of file - int32 expected
2 Incorrect 313 ms 6268 KB Unexpected end of file - int32 expected
3 Incorrect 310 ms 6392 KB Unexpected end of file - int32 expected
4 Incorrect 308 ms 6392 KB Unexpected end of file - int32 expected
5 Incorrect 304 ms 6392 KB Unexpected end of file - int32 expected
6 Incorrect 299 ms 6392 KB Unexpected end of file - int32 expected
7 Incorrect 307 ms 6392 KB Unexpected end of file - int32 expected
8 Incorrect 329 ms 6392 KB Unexpected end of file - int32 expected
9 Incorrect 251 ms 5112 KB Unexpected end of file - int32 expected
10 Incorrect 99 ms 2168 KB Unexpected end of file - int32 expected
11 Incorrect 165 ms 3320 KB Unexpected end of file - int32 expected
12 Incorrect 5 ms 256 KB Unexpected end of file - int32 expected
13 Incorrect 5 ms 256 KB Unexpected end of file - int32 expected
14 Incorrect 5 ms 256 KB Unexpected end of file - int32 expected