답안 #209818

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209818 2020-03-15T15:25:28 Z nicolaalexandra Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
1000 ms 8440 KB
#include <bits/stdc++.h>
#define DIM 1000010
using namespace std;
int v[DIM];
int n,i,poz,sol,idx,k;
void solve (int val){
    if (val == 1 || sol)
        return;

    if (v[idx] == val-1){
        /// inseamna ca in stanga nu ma mai duc deloc
        idx++;
    } else {
        /// pot sa ma duc
        if (v[idx] > val-1){
            sol = val-1, poz = idx-1;
            return;
        }
        solve (val-1);
    }

    /// acum dreapta
    if (v[idx] == val-1)
        idx++;
    else {
        if (v[idx] > val-1){
            sol = val-1, poz = idx-1;
            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 == poz)
            cout<<sol<<" ";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1076 ms 6264 KB Time limit exceeded
2 Execution timed out 1084 ms 6264 KB Time limit exceeded
3 Execution timed out 1071 ms 6264 KB Time limit exceeded
4 Execution timed out 1059 ms 6264 KB Time limit exceeded
5 Execution timed out 1092 ms 6264 KB Time limit exceeded
6 Execution timed out 1077 ms 6264 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 290 ms 8416 KB Unexpected end of file - int32 expected
2 Incorrect 296 ms 8312 KB Unexpected end of file - int32 expected
3 Execution timed out 1022 ms 6308 KB Time limit exceeded
4 Incorrect 296 ms 8420 KB Unexpected end of file - int32 expected
5 Incorrect 301 ms 8440 KB Unexpected end of file - int32 expected
6 Incorrect 294 ms 8312 KB Unexpected end of file - int32 expected
7 Incorrect 306 ms 8440 KB Unexpected end of file - int32 expected
8 Execution timed out 1098 ms 6264 KB Time limit exceeded
9 Incorrect 237 ms 6776 KB Unexpected end of file - int32 expected
10 Incorrect 94 ms 2808 KB Unexpected end of file - int32 expected
11 Incorrect 145 ms 4344 KB Unexpected end of file - int32 expected
12 Incorrect 5 ms 256 KB Unexpected end of file - int32 expected
13 Execution timed out 1094 ms 256 KB Time limit exceeded
14 Execution timed out 1097 ms 256 KB Time limit exceeded