답안 #713742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713742 2023-03-23T02:01:19 Z LittleOrange 자동 인형 (IOI18_doll) C++17
6 / 100
85 ms 11660 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;

void create_circuit(int M, std::vector<int> A) {
  int N = A.size();
  std::vector<int> C(M + 1,0);
  C[0] = A[0];
  if (N == 1){
    for (int i = 1; i <= M; ++i) C[i] = 0;
    vector<int> X,Y; 
    answer(C, X, Y);
    return;
  }
  A.push_back(0);
  vector<vector<ll>> nxt(M);
  for(ll i = 0;i<N;i++){
    nxt[A[i]-1].push_back(A[i+1]);
  }
  for(auto &o : nxt){
    if (o.size()>2) o.resize(1<<(__lg(o.size()-1)+1),-1);
  }
  vector<int> X,Y;
  ll it = 0;
  vector<ll> CUR;
  ll root;
  function<ll(ll,ll,ll)> dfs;
  dfs = [&](ll cnt, ll st, ll lv){
    //cerr << "dfs " << cnt << " " << st << " " << lv << "\n";
    if (cnt==1){
        return CUR[st]==-1?root:CUR[st];
    }
    ll i = it++;
    X.push_back(dfs(cnt-cnt/2,st,lv+1));
    Y.push_back(dfs(cnt/2,st+(1<<lv),lv+1));
    return -1-i;
  };
  for(ll i = 0;i<M;i++){
    CUR = nxt[i];
    if (CUR.size()>1){
        C[i+1] = root = -1-it;
        dfs(CUR.size(),0,0);
    }else if(CUR.size()==1){
        C[i+1] = CUR[0];
    }
  }
  for(ll i = 0;i<N;i++) {
    //cerr << "nxt " << i << ":";
    //for(ll j : nxt[i]) cerr << " " << j;
    //cerr << "\n";
  }
  answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 24 ms 6320 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 32 ms 7656 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 24 ms 6320 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 32 ms 7656 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 46 ms 7252 KB Output is correct
9 Correct 48 ms 8956 KB Output is correct
10 Correct 76 ms 11660 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 24 ms 6320 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 32 ms 7656 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 46 ms 7252 KB Output is correct
9 Correct 48 ms 8956 KB Output is correct
10 Correct 76 ms 11660 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Incorrect 85 ms 11328 KB wrong motion
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -