Submission #209834

# Submission time Handle Problem Language Result Execution time Memory
209834 2020-03-15T16:33:03 Z nicolaalexandra Zalmoxis (BOI18_zalmoxis) C++14
30 / 100
320 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){ /// nu mai pot sa ma duc in stanga ca am deja valoarea
        idx++;
        return idx;
    }

    if (!val)
        return 0;

    /// stanga
    val--;
    int poz = solve (val);

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

        return poz;
    }

    /// dreapta
    return solve (val);
}

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;
}
# Verdict Execution time Memory Grader output
1 Correct 313 ms 6264 KB Output is correct
2 Correct 309 ms 6392 KB Output is correct
3 Correct 317 ms 6320 KB Output is correct
4 Correct 313 ms 6392 KB Output is correct
5 Correct 307 ms 6392 KB Output is correct
6 Correct 313 ms 6264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 311 ms 6264 KB Unexpected end of file - int32 expected
2 Incorrect 320 ms 6264 KB Unexpected end of file - int32 expected
3 Incorrect 312 ms 6320 KB Unexpected end of file - int32 expected
4 Incorrect 306 ms 6392 KB Unexpected end of file - int32 expected
5 Incorrect 314 ms 6348 KB Unexpected end of file - int32 expected
6 Incorrect 311 ms 6392 KB Unexpected end of file - int32 expected
7 Incorrect 308 ms 6392 KB Unexpected end of file - int32 expected
8 Incorrect 308 ms 6392 KB Unexpected end of file - int32 expected
9 Incorrect 248 ms 5112 KB Unexpected end of file - int32 expected
10 Incorrect 100 ms 2168 KB Unexpected end of file - int32 expected
11 Incorrect 161 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 4 ms 256 KB Unexpected end of file - int32 expected