Submission #854334

# Submission time Handle Problem Language Result Execution time Memory
854334 2023-09-26T20:49:19 Z JoksimKaktus medians (balkan11_medians) C++17
5 / 100
19 ms 2472 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    int n;
    cin >> n;
    bool arr[n*2];
    for(int i = 0;i < n*2;i++){
        arr[i] = false;
    }
    int x;
    cin >> x;
    cout << x << " ";
    arr[x] = true;
    int l = 1;
    if(x == 1) l++;
    int r = 2*n-1;
    if(x == r) r--;
    int last = x;
    for(int i = 1;i < n;i++){
        cin >> x;
        if(x == last){
            cout << l << " " << r << " ";
            arr[l] = true;
            while(arr[l]){
                l++;
            }
            arr[r] = true;
            while(arr[r]){
                r--;
            }
        }else if(x > last){
            cout << x << " " << r << " ";
            arr[x] = true;
            arr[r] = true;
            while(arr[r]){
                r--;
            }
        }else{
            cout << x << " " << l << " ";
            arr[x] = true;
            arr[l] = true;
            while(arr[l]){
                l++;
            }
        }
        last = x;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not a permutation
2 Incorrect 0 ms 344 KB Not a permutation
3 Incorrect 1 ms 348 KB Not a permutation
4 Incorrect 0 ms 348 KB Not a permutation
5 Incorrect 0 ms 600 KB Not a permutation
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 344 KB Not a permutation
8 Incorrect 0 ms 348 KB Not a permutation
9 Incorrect 1 ms 348 KB Not a permutation
10 Incorrect 0 ms 348 KB Not a permutation
11 Incorrect 0 ms 348 KB Not a permutation
12 Incorrect 0 ms 348 KB Not a permutation
13 Incorrect 0 ms 456 KB Not a permutation
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Not a permutation
2 Incorrect 1 ms 348 KB Not a permutation
3 Incorrect 2 ms 348 KB Not a permutation
4 Incorrect 3 ms 604 KB Not a permutation
5 Incorrect 6 ms 860 KB Not a permutation
6 Incorrect 12 ms 1628 KB Not a permutation
7 Incorrect 19 ms 2472 KB Not a permutation