답안 #205167

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
205167 2020-02-28T08:46:09 Z theStaticMind 도서관 (JOI18_library) C++14
0 / 100
276 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 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;
            arr[r + 1] = 1;

            if(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);
                  adj[x].pb(ind);
                  adj[ind].pb(x);
                  x = bin(x + 1, ind - 1);
                  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);
                  x = adj[x][0];
            }
            else{
                  if(ans.back() == adj[x][0]){
                        ans.pb(x);
                        x = adj[x][1];
                  }
                  else{
                        ans.pb(x);
                        x = adj[x][0];
                  }
            }
      }
      Answer(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 18 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 19 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 28 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 20 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 22 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 26 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 16 ms 476 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 11 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Incorrect 5 ms 252 KB Wrong Answer [5]
13 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 18 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 19 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 28 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 20 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 22 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 26 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 16 ms 476 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 20 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 11 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Incorrect 5 ms 252 KB Wrong Answer [5]
13 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 182 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 167 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 179 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 151 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 161 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 162 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 182 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 69 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 170 ms 484 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 153 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 59 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Incorrect 260 ms 380 KB Wrong Answer [5]
29 Incorrect 255 ms 504 KB Wrong Answer [5]
30 Incorrect 276 ms 504 KB Wrong Answer [5]