# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
297642 | 2020-09-11T17:08:00 Z | davi_bart | 자동 인형 (IOI18_doll) | C++14 | 151 ms | 13200 KB |
#include<bits/stdc++.h> #include "doll.h" using namespace std; #define ll long long #define fi first #define se second void answer(std::vector<int> C, std::vector<int> X, std::vector<int> Y); void create_circuit(int M, std::vector<int> A) { int N = A.size(); std::vector<int> C(M+1,0); vector<int> X,Y; vector<int> volte[M+2]; vector<bool> vis(M+2,0); A.push_back(0); for(int i=0;i<A.size()-1;i++){ volte[A[i]].push_back(A[i+1]); } C[0]=A[0]; int S=1; for(int i=0;i<A.size()-1;i++){ int x=A[i]; if(volte[x].size()>=2){ if(vis[x])continue; vis[x]=1; int y=volte[x].size(); int lg=31-__builtin_clz(y); if((1<<lg)!=y)lg++; //cout<<lg<<endl; vector<int> k(1<<lg); for(int i=0;i<lg;i++){ for(int j=0;j<(1<<lg);j+=(1<<(lg-i))){ k[j+(1<<(lg-i-1))]=k[j]+(1<<i); } } C[A[i]]=-S; int q=volte[x].back(); volte[x].pop_back(); while(volte[x].size()<(1<<lg))volte[x].push_back(-S); volte[x].pop_back(); volte[x].push_back(q); //for(int a:volte[x])cout<<a<<" "; //cout<<endl; int s=S; for(int i=1;i<(1<<lg);i++){ if(i<(1<<(lg-1))){ X.push_back(-(2*i+s-1)); Y.push_back(-(2*i+s)); }else{ X.push_back(volte[x][k[2*i-(1<<lg)]]); Y.push_back(volte[x][k[2*i+1-(1<<lg)]]); } S++; } continue; } C[x]=A[i+1]; } answer(C, X, Y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 42 ms | 6340 KB | Output is correct |
3 | Correct | 36 ms | 5060 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 3788 KB | Output is correct |
6 | Correct | 68 ms | 7612 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 42 ms | 6340 KB | Output is correct |
3 | Correct | 36 ms | 5060 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 3788 KB | Output is correct |
6 | Correct | 68 ms | 7612 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
8 | Correct | 71 ms | 7668 KB | Output is correct |
9 | Correct | 72 ms | 8724 KB | Output is correct |
10 | Correct | 129 ms | 12040 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 42 ms | 6340 KB | Output is correct |
3 | Correct | 36 ms | 5060 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 3788 KB | Output is correct |
6 | Correct | 68 ms | 7612 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
8 | Correct | 71 ms | 7668 KB | Output is correct |
9 | Correct | 72 ms | 8724 KB | Output is correct |
10 | Correct | 129 ms | 12040 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 151 ms | 11476 KB | Output is correct |
15 | Correct | 68 ms | 6744 KB | Output is correct |
16 | Correct | 93 ms | 8756 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 124 ms | 10804 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 204 KB | Output is partially correct |
2 | Correct | 54 ms | 6340 KB | Output is correct |
3 | Partially correct | 86 ms | 8416 KB | Output is partially correct |
4 | Partially correct | 87 ms | 9376 KB | Output is partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 204 KB | Output is partially correct |
2 | Correct | 54 ms | 6340 KB | Output is correct |
3 | Partially correct | 86 ms | 8416 KB | Output is partially correct |
4 | Partially correct | 87 ms | 9376 KB | Output is partially correct |
5 | Partially correct | 142 ms | 11984 KB | Output is partially correct |
6 | Partially correct | 130 ms | 12620 KB | Output is partially correct |
7 | Partially correct | 136 ms | 12536 KB | Output is partially correct |
8 | Partially correct | 131 ms | 12764 KB | Output is partially correct |
9 | Partially correct | 74 ms | 9892 KB | Output is partially correct |
10 | Partially correct | 126 ms | 13200 KB | Output is partially correct |
11 | Partially correct | 146 ms | 13084 KB | Output is partially correct |
12 | Partially correct | 75 ms | 9252 KB | Output is partially correct |
13 | Partially correct | 84 ms | 8300 KB | Output is partially correct |
14 | Partially correct | 77 ms | 8144 KB | Output is partially correct |
15 | Partially correct | 75 ms | 8008 KB | Output is partially correct |
16 | Partially correct | 3 ms | 564 KB | Output is partially correct |
17 | Partially correct | 67 ms | 7076 KB | Output is partially correct |
18 | Partially correct | 73 ms | 7232 KB | Output is partially correct |
19 | Partially correct | 67 ms | 7568 KB | Output is partially correct |
20 | Partially correct | 98 ms | 9868 KB | Output is partially correct |
21 | Partially correct | 107 ms | 11668 KB | Output is partially correct |
22 | Partially correct | 84 ms | 9260 KB | Output is partially correct |