Submission #641992

# Submission time Handle Problem Language Result Execution time Memory
641992 2022-09-18T08:21:27 Z Tsiannis medians (balkan11_medians) C++17
0 / 100
45 ms 3892 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 10000009
int main ()
{
  ll n; cin>>n;
  ll B[n];
  for (int i=0;i<n;i++){
     cin>>B[i];
  }
  ll A[2*n-1];
  A[0]=B[0];
  ll mn=1;
  ll mx=2*n-1;
  if (A[0]==1)
    mn=2;
  A[1]=B[1];
  if (B[1]==2)
  mn=3;
  A[2]=mx;
  mx--;
  ll idx=2;
  for (int i=3;i<=2*n-2;i+=2){
    if (B[idx]==B[idx-1])
    {
      A[i]=mn;
      A[i+1]=mx;
      mn++;
      mx--;
    }
    else
    {
      A[i]=B[idx];
      if (B[idx]==mn)
      mn++;
      A[i+1]=mx;
      mx--;
    }
    idx++;
  }
  for (int i=0;i<2*n-1;i++)
    cout<<A[i]<<' ';
    cout<<endl;

    return 0;
}

Compilation message

medians.cpp: In function 'int main()':
medians.cpp:42:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   42 |   for (int i=0;i<2*n-1;i++)
      |   ^~~
medians.cpp:44:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   44 |     cout<<endl;
      |     ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Not a permutation
2 Incorrect 1 ms 212 KB Not a permutation
3 Incorrect 0 ms 212 KB Not a permutation
4 Incorrect 1 ms 212 KB Not a permutation
5 Incorrect 0 ms 212 KB Not a permutation
6 Incorrect 0 ms 212 KB Not a permutation
7 Incorrect 0 ms 212 KB Not a permutation
8 Incorrect 0 ms 212 KB Not a permutation
9 Incorrect 0 ms 212 KB Not a permutation
10 Incorrect 1 ms 212 KB Not a permutation
11 Incorrect 1 ms 212 KB Not a permutation
12 Incorrect 1 ms 212 KB Not a permutation
13 Incorrect 1 ms 212 KB Not a permutation
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Not a permutation
2 Incorrect 3 ms 340 KB Not a permutation
3 Incorrect 4 ms 468 KB Not a permutation
4 Incorrect 8 ms 800 KB Not a permutation
5 Incorrect 13 ms 1328 KB Not a permutation
6 Incorrect 26 ms 2480 KB Not a permutation
7 Incorrect 45 ms 3892 KB Not a permutation