# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
312417 | 2020-10-13T06:39:50 Z | kylych03 | 자동 인형 (IOI18_doll) | C++14 | 341 ms | 178468 KB |
#include "doll.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; int vis[200002]; vector <int> x,y; deque <int> vec[200002]; int cnt = 1; bool f; int m; void rec(deque <int > v, int k){ deque <int> v1, v2; if(v.size()==0) return ; if(v.size()==2){ x.push_back(v[0]); y.push_back(v[1]); cnt++; return ; } int i = 0; if(f || m==1) for(; i < v.size()/2; i++){ if(v[i] < 0) v1.push_back(v[i]); else{ break; } } f=false; for( ; i < v.size(); i++){ if(v1.size() > v2.size()) v2.push_back(v[i]); else v1.push_back(v[i]); } int p = cnt; cnt++; y.push_back(-cnt); if(v1[v1.size()-1] >=0){ x.push_back(-cnt); rec(v1,k); } else x.push_back(k); y[p-1]=-cnt; rec(v2,k); } void create_circuit(int M, std::vector<int> A) { m = M; vector<int> C(M + 1); vector <int> X, Y; for(int i = 0; i<M+1; i++){ C[i]=0; } C[0]=A[0]; A.push_back(0); int N = A.size(); for(int i = 0 ; i < N; i++){ vec[A[i]].push_back(A[i+1]); } for(int i = 1 ; i <=M ;i++){ if(vec[i].size()>1){ C[i] = -cnt; int pw = 1; while(pw < vec[i].size()){ pw = pw * 2; } int len = vec[i].size(); while(len < pw){ len++; vec[i].push_front(C[i]); } f=true; rec( vec[i],C[i]); } if(vec[i].size()==1) C[i]=vec[i][0]; } /* for(int i = 0; i <C.size(); i++) cout << C[i]<<" "; cout << endl; for(int i = 0; i <x.size(); i++) cout << x[i]<<" "<<y[i]<<endl; cout << endl; */ answer(C, x, y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 93 ms | 134980 KB | Output is correct |
2 | Correct | 147 ms | 136540 KB | Output is correct |
3 | Correct | 113 ms | 136224 KB | Output is correct |
4 | Correct | 127 ms | 134912 KB | Output is correct |
5 | Correct | 114 ms | 136112 KB | Output is correct |
6 | Correct | 152 ms | 136768 KB | Output is correct |
7 | Correct | 112 ms | 134920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 93 ms | 134980 KB | Output is correct |
2 | Correct | 147 ms | 136540 KB | Output is correct |
3 | Correct | 113 ms | 136224 KB | Output is correct |
4 | Correct | 127 ms | 134912 KB | Output is correct |
5 | Correct | 114 ms | 136112 KB | Output is correct |
6 | Correct | 152 ms | 136768 KB | Output is correct |
7 | Correct | 112 ms | 134920 KB | Output is correct |
8 | Correct | 196 ms | 138760 KB | Output is correct |
9 | Correct | 190 ms | 138336 KB | Output is correct |
10 | Correct | 242 ms | 141140 KB | Output is correct |
11 | Correct | 94 ms | 134896 KB | Output is correct |
12 | Correct | 115 ms | 134920 KB | Output is correct |
13 | Correct | 114 ms | 134832 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 93 ms | 134980 KB | Output is correct |
2 | Correct | 147 ms | 136540 KB | Output is correct |
3 | Correct | 113 ms | 136224 KB | Output is correct |
4 | Correct | 127 ms | 134912 KB | Output is correct |
5 | Correct | 114 ms | 136112 KB | Output is correct |
6 | Correct | 152 ms | 136768 KB | Output is correct |
7 | Correct | 112 ms | 134920 KB | Output is correct |
8 | Correct | 196 ms | 138760 KB | Output is correct |
9 | Correct | 190 ms | 138336 KB | Output is correct |
10 | Correct | 242 ms | 141140 KB | Output is correct |
11 | Correct | 94 ms | 134896 KB | Output is correct |
12 | Correct | 115 ms | 134920 KB | Output is correct |
13 | Correct | 114 ms | 134832 KB | Output is correct |
14 | Correct | 341 ms | 178468 KB | Output is correct |
15 | Correct | 172 ms | 139644 KB | Output is correct |
16 | Correct | 219 ms | 141812 KB | Output is correct |
17 | Correct | 116 ms | 134852 KB | Output is correct |
18 | Correct | 105 ms | 134924 KB | Output is correct |
19 | Correct | 105 ms | 134812 KB | Output is correct |
20 | Correct | 262 ms | 157672 KB | Output is correct |
21 | Correct | 134 ms | 134924 KB | Output is correct |
22 | Correct | 114 ms | 134924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 107 ms | 134928 KB | Output is correct |
2 | Correct | 111 ms | 134868 KB | Output is correct |
3 | Correct | 91 ms | 134888 KB | Output is correct |
4 | Correct | 133 ms | 134928 KB | Output is correct |
5 | Correct | 92 ms | 134896 KB | Output is correct |
6 | Correct | 94 ms | 134856 KB | Output is correct |
7 | Correct | 95 ms | 134960 KB | Output is correct |
8 | Correct | 118 ms | 134824 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 97 ms | 134936 KB | Output is correct |
2 | Correct | 219 ms | 142208 KB | Output is correct |
3 | Correct | 218 ms | 144448 KB | Output is correct |
4 | Correct | 292 ms | 146920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 97 ms | 134936 KB | Output is correct |
2 | Correct | 219 ms | 142208 KB | Output is correct |
3 | Correct | 218 ms | 144448 KB | Output is correct |
4 | Correct | 292 ms | 146920 KB | Output is correct |
5 | Partially correct | 300 ms | 164012 KB | Output is partially correct |
6 | Partially correct | 310 ms | 154692 KB | Output is partially correct |
7 | Partially correct | 287 ms | 157740 KB | Output is partially correct |
8 | Partially correct | 291 ms | 148724 KB | Output is partially correct |
9 | Partially correct | 229 ms | 142504 KB | Output is partially correct |
10 | Partially correct | 288 ms | 148748 KB | Output is partially correct |
11 | Partially correct | 285 ms | 142932 KB | Output is partially correct |
12 | Partially correct | 227 ms | 140364 KB | Output is partially correct |
13 | Partially correct | 232 ms | 147800 KB | Output is partially correct |
14 | Partially correct | 221 ms | 150280 KB | Output is partially correct |
15 | Partially correct | 251 ms | 154040 KB | Output is partially correct |
16 | Partially correct | 133 ms | 135272 KB | Output is partially correct |
17 | Partially correct | 209 ms | 141552 KB | Output is partially correct |
18 | Partially correct | 231 ms | 140440 KB | Output is partially correct |
19 | Partially correct | 236 ms | 142108 KB | Output is partially correct |
20 | Partially correct | 277 ms | 144288 KB | Output is partially correct |
21 | Partially correct | 305 ms | 144752 KB | Output is partially correct |
22 | Partially correct | 324 ms | 143776 KB | Output is partially correct |