# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
771577 | 2023-07-03T06:38:22 Z | ttamx | 자동 인형 (IOI18_doll) | C++14 | 94 ms | 15504 KB |
#include "doll.h" #include<bits/stdc++.h> using namespace std; void create_circuit(int m,vector<int> a) { int n = a.size(); vector<int> c(m+1); vector<int> lg(n+1); for(int i=2;i<=n;i++)lg[i]=lg[i/2]+1; c[0]=a[0]; vector<int> x,y; auto add=[&](int u,int v){ x.emplace_back(u); y.emplace_back(v); return -x.size(); }; vector<vector<int>> vec(m+1); a.emplace_back(0); for(int i=0;i<n;i++)vec[a[i]].emplace_back(a[i+1]); for(int i=1;i<=m;i++){ int sz=vec[i].size(); if(sz==0){ c[i]=0; continue; } if(sz==1){ c[i]=vec[i][0]; continue; } int lv=lg[sz-1]+1; vector<int> res; int cnt=1<<(lv-1); int tar=-(x.size()+(1<<lv)-1); int st=(1<<lv)-sz+1; vector<int> pos(1<<lv); for(int j=0;j<1<<lv;j++){ for(int k=0;k<lv;k++)if((j>>k)&1)pos[j]+=1<<(lv-k-1); pos[j]++; } for(int k=0;k<cnt;k++){ int u=pos[k*2],v=pos[k*2+1]; res.emplace_back(add(u<st?tar:vec[i][u-st],v<st?tar:vec[i][v-st])); } while(res.size()>1){ vector<int> tmp; for(int i=0;i<res.size();i+=2)tmp.emplace_back(add(res[i],res[i+1])); res=tmp; } c[i]=res[0]; } answer(c,x,y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 26 ms | 6608 KB | Output is correct |
3 | Correct | 15 ms | 5428 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 3796 KB | Output is correct |
6 | Correct | 30 ms | 8116 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 | 26 ms | 6608 KB | Output is correct |
3 | Correct | 15 ms | 5428 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 3796 KB | Output is correct |
6 | Correct | 30 ms | 8116 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 35 ms | 7796 KB | Output is correct |
9 | Correct | 36 ms | 9168 KB | Output is correct |
10 | Correct | 58 ms | 12092 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 26 ms | 6608 KB | Output is correct |
3 | Correct | 15 ms | 5428 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 8 ms | 3796 KB | Output is correct |
6 | Correct | 30 ms | 8116 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 35 ms | 7796 KB | Output is correct |
9 | Correct | 36 ms | 9168 KB | Output is correct |
10 | Correct | 58 ms | 12092 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 70 ms | 11684 KB | Output is correct |
15 | Correct | 36 ms | 6452 KB | Output is correct |
16 | Correct | 55 ms | 9388 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 61 ms | 11404 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 212 KB | Output is partially correct |
2 | Correct | 36 ms | 6448 KB | Output is correct |
3 | Partially correct | 63 ms | 8512 KB | Output is partially correct |
4 | Partially correct | 69 ms | 9732 KB | Output is partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 212 KB | Output is partially correct |
2 | Correct | 36 ms | 6448 KB | Output is correct |
3 | Partially correct | 63 ms | 8512 KB | Output is partially correct |
4 | Partially correct | 69 ms | 9732 KB | Output is partially correct |
5 | Partially correct | 79 ms | 12836 KB | Output is partially correct |
6 | Partially correct | 87 ms | 14772 KB | Output is partially correct |
7 | Partially correct | 81 ms | 14616 KB | Output is partially correct |
8 | Partially correct | 87 ms | 14912 KB | Output is partially correct |
9 | Partially correct | 62 ms | 10064 KB | Output is partially correct |
10 | Partially correct | 93 ms | 15504 KB | Output is partially correct |
11 | Partially correct | 94 ms | 15460 KB | Output is partially correct |
12 | Partially correct | 69 ms | 10696 KB | Output is partially correct |
13 | Partially correct | 53 ms | 9680 KB | Output is partially correct |
14 | Partially correct | 53 ms | 9588 KB | Output is partially correct |
15 | Partially correct | 51 ms | 9412 KB | Output is partially correct |
16 | Partially correct | 2 ms | 596 KB | Output is partially correct |
17 | Partially correct | 43 ms | 8520 KB | Output is partially correct |
18 | Partially correct | 48 ms | 8620 KB | Output is partially correct |
19 | Partially correct | 49 ms | 8904 KB | Output is partially correct |
20 | Partially correct | 68 ms | 12108 KB | Output is partially correct |
21 | Partially correct | 78 ms | 13976 KB | Output is partially correct |
22 | Partially correct | 67 ms | 11576 KB | Output is partially correct |