답안 #421633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
421633 2021-06-09T10:14:22 Z marcipan5000 자동 인형 (IOI18_doll) C++14
53 / 100
172 ms 16912 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> t[100001];
vector<int> c,x,y;
int p=-1;
int g;
int s;

int rev(int q,int w) {
  int ans=0;
  for (int i=0;i<q;i++) {
    if ((w>>i)%2==1) {
      ans=(ans^(1<<(q-i-1)));
    }
  }
  return(ans);
}

int build(int a,int b,int r,int z) {
  if (a==b) {
    return(t[z][rev(r,a)]);
  }
  int p2=p; p--;
  int x1,y1;
  x1=build(a,(a+b)/2,r,z);
  y1=build((a+b)/2+1,b,r,z);
  /* cout << a << " " << b << " " << r << " " << z << " " << x1 << " " << y1 << endl; */
  x[-1*p2-1]=x1;
  y[-1*p2-1]=y1;
  return(p2);
}

void create_circuit (int M, std::vector<int> A) {
    int n=A.size();

    for (int i=0;i<n-1;i++) {
        t[A[i]].push_back(A[i+1]);
    }

    t[A[n-1]].push_back(0);
    t[0].push_back(A[0]);
    
    x.resize(400000);
    y.resize(400000);

    for (int i=0;i<=M;i++) {
        if (t[i].size()==0) {
          c.push_back(0);
        }
        if (t[i].size()==1) {
          c.push_back(t[i][0]);
        }
        if (t[i].size()>1) {
          g=pow(2,int(log2(int(t[i].size())-1))+1);
          s=t[i].size()-1;
          t[i].resize(g);
          t[i][g-1]=t[i][s];
          for (int j=s;j<g-1;j++) {
            t[i][j]=p;
          }
          c.push_back(build(0,g-1,int(log2(g)),i));
        }
    }
    
    x.resize(-1*p-1);
    y.resize(-1*p-1);

    answer(c,x,y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5708 KB Output is correct
2 Correct 33 ms 9696 KB Output is correct
3 Correct 31 ms 9276 KB Output is correct
4 Correct 4 ms 5836 KB Output is correct
5 Correct 18 ms 6980 KB Output is correct
6 Correct 47 ms 11036 KB Output is correct
7 Correct 4 ms 5708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5708 KB Output is correct
2 Correct 33 ms 9696 KB Output is correct
3 Correct 31 ms 9276 KB Output is correct
4 Correct 4 ms 5836 KB Output is correct
5 Correct 18 ms 6980 KB Output is correct
6 Correct 47 ms 11036 KB Output is correct
7 Correct 4 ms 5708 KB Output is correct
8 Correct 69 ms 11404 KB Output is correct
9 Correct 80 ms 11700 KB Output is correct
10 Correct 100 ms 13408 KB Output is correct
11 Correct 3 ms 5708 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 3 ms 5708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5708 KB Output is correct
2 Correct 33 ms 9696 KB Output is correct
3 Correct 31 ms 9276 KB Output is correct
4 Correct 4 ms 5836 KB Output is correct
5 Correct 18 ms 6980 KB Output is correct
6 Correct 47 ms 11036 KB Output is correct
7 Correct 4 ms 5708 KB Output is correct
8 Correct 69 ms 11404 KB Output is correct
9 Correct 80 ms 11700 KB Output is correct
10 Correct 100 ms 13408 KB Output is correct
11 Correct 3 ms 5708 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 3 ms 5708 KB Output is correct
14 Correct 131 ms 14140 KB Output is correct
15 Correct 60 ms 9952 KB Output is correct
16 Correct 114 ms 12160 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5708 KB Output is correct
20 Correct 114 ms 13532 KB Output is correct
21 Correct 4 ms 5716 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 5708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4 ms 5708 KB Output is partially correct
2 Correct 73 ms 9616 KB Output is correct
3 Partially correct 125 ms 12184 KB Output is partially correct
4 Partially correct 105 ms 12620 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4 ms 5708 KB Output is partially correct
2 Correct 73 ms 9616 KB Output is correct
3 Partially correct 125 ms 12184 KB Output is partially correct
4 Partially correct 105 ms 12620 KB Output is partially correct
5 Partially correct 135 ms 15768 KB Output is partially correct
6 Partially correct 133 ms 16468 KB Output is partially correct
7 Partially correct 119 ms 16232 KB Output is partially correct
8 Partially correct 145 ms 16716 KB Output is partially correct
9 Partially correct 142 ms 12564 KB Output is partially correct
10 Partially correct 172 ms 16796 KB Output is partially correct
11 Partially correct 164 ms 16912 KB Output is partially correct
12 Partially correct 117 ms 13180 KB Output is partially correct
13 Partially correct 79 ms 12816 KB Output is partially correct
14 Partially correct 113 ms 12552 KB Output is partially correct
15 Partially correct 78 ms 12328 KB Output is partially correct
16 Partially correct 5 ms 5964 KB Output is partially correct
17 Partially correct 70 ms 11440 KB Output is partially correct
18 Partially correct 92 ms 11332 KB Output is partially correct
19 Partially correct 80 ms 11968 KB Output is partially correct
20 Partially correct 98 ms 13636 KB Output is partially correct
21 Partially correct 131 ms 15272 KB Output is partially correct
22 Partially correct 99 ms 12904 KB Output is partially correct