Submission #205188

# Submission time Handle Problem Language Result Execution time Memory
205188 2020-02-28T09:28:39 Z theStaticMind Library (JOI18_library) C++14
0 / 100
427 ms 632 KB
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
//#define int long long int
using namespace std;

#include<library.h>

vector<int> Q(1001, 0);
int ind = 0;
int n;

vector<int> adj[1001];

int bin(int l, int r, int v, bool eq = true){
      int ret = -1;
      while(l <= r){
            int mid = (l + r) / 2;
            vector<int> arr(n, 0);
            for(int i = 0; i <= mid; i++)arr[i] = 1;
            for(int i = mid + 1; i < n; i++)arr[i] = 0;
            arr[v] = 1;

            if((eq && Query(arr) <= Q[mid]) || (!eq && Query(arr) < Q[mid])){
                  ret = mid;
                  r = mid - 1;
            }
            else{
                  l = mid + 1;
            }
      }
      return ret;
}

void Solve(int N){
      n = N;
      vector<int> arr(n, 0);

      for(;ind < n; ind++){
            arr[ind] = 1;
            Q[ind] = Query(arr);
            if(ind != 0 && Q[ind] <= Q[ind - 1]){
                  int x = bin(0, ind - 1, ind, true);
                  adj[x].pb(ind);
                  adj[ind].pb(x);

                  x = bin(x + 1, ind - 1, ind, false);
                  if(x != -1){

                        adj[x].pb(ind);
                        adj[ind].pb(x);
                  }
            }
      }

      int root = 0;
      while(sz(adj[root]) == 2)root++;

      vector<int> ans;
      int x = root;
      for(int i = 0; i < n; i++){
            if(adj[x].size() == 1){
                  ans.pb(x+1);
                  x = adj[x][0];
            }
            else{
                  if(ans.back() == adj[x][0]){
                        ans.pb(x+1);
                        x = adj[x][1];
                  }
                  else{
                        ans.pb(x+1);
                        x = adj[x][0];
                  }
            }
      }
      Answer(ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 376 KB Wrong Answer [6]
2 Incorrect 30 ms 248 KB Wrong Answer [6]
3 Incorrect 35 ms 248 KB Wrong Answer [6]
4 Incorrect 34 ms 248 KB Wrong Answer [6]
5 Incorrect 37 ms 248 KB Wrong Answer [6]
6 Incorrect 35 ms 376 KB Wrong Answer [6]
7 Incorrect 26 ms 340 KB Wrong Answer [6]
8 Incorrect 24 ms 344 KB Wrong Answer [6]
9 Incorrect 33 ms 252 KB Wrong Answer [6]
10 Incorrect 22 ms 248 KB Wrong Answer [6]
11 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 5 ms 248 KB # of queries: 3
13 Incorrect 5 ms 248 KB Wrong Answer [6]
14 Incorrect 5 ms 376 KB Wrong Answer [6]
15 Incorrect 6 ms 376 KB Wrong Answer [6]
16 Incorrect 7 ms 248 KB Wrong Answer [6]
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 376 KB Wrong Answer [6]
2 Incorrect 30 ms 248 KB Wrong Answer [6]
3 Incorrect 35 ms 248 KB Wrong Answer [6]
4 Incorrect 34 ms 248 KB Wrong Answer [6]
5 Incorrect 37 ms 248 KB Wrong Answer [6]
6 Incorrect 35 ms 376 KB Wrong Answer [6]
7 Incorrect 26 ms 340 KB Wrong Answer [6]
8 Incorrect 24 ms 344 KB Wrong Answer [6]
9 Incorrect 33 ms 252 KB Wrong Answer [6]
10 Incorrect 22 ms 248 KB Wrong Answer [6]
11 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 5 ms 248 KB # of queries: 3
13 Incorrect 5 ms 248 KB Wrong Answer [6]
14 Incorrect 5 ms 376 KB Wrong Answer [6]
15 Incorrect 6 ms 376 KB Wrong Answer [6]
16 Incorrect 7 ms 248 KB Wrong Answer [6]
17 Incorrect 348 ms 480 KB Wrong Answer [6]
18 Incorrect 330 ms 376 KB Wrong Answer [6]
19 Incorrect 329 ms 356 KB Wrong Answer [6]
20 Incorrect 298 ms 376 KB Wrong Answer [6]
21 Incorrect 338 ms 376 KB Wrong Answer [6]
22 Incorrect 335 ms 504 KB Wrong Answer [6]
23 Incorrect 427 ms 504 KB Wrong Answer [6]
24 Incorrect 148 ms 380 KB Wrong Answer [6]
25 Incorrect 314 ms 376 KB Wrong Answer [6]
26 Incorrect 291 ms 376 KB Wrong Answer [6]
27 Incorrect 113 ms 248 KB Wrong Answer [6]
28 Incorrect 276 ms 632 KB Wrong Answer [6]
29 Incorrect 270 ms 376 KB Wrong Answer [6]
30 Incorrect 302 ms 348 KB Wrong Answer [6]