# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333192 | 2020-12-04T22:26:49 Z | couplefire | 자동 인형 (IOI18_doll) | C++17 | 165 ms | 13212 KB |
#include "doll.h" #include <bits/stdc++.h> using namespace std; #define INF 1000000009 void create_circuit(int m, vector<int> events) { events.push_back(0); int n = events.size(); int numLvl = ceil(log2(0.0+n)); int curNum = n; vector<vector<int>> num(numLvl); for(int i = numLvl-1; i>=0; i--){ num[i].resize(curNum = (curNum+1)/2); } int label = 1; vector<int> ch[2]; ch[0] = vector<int>(2*n, -INF); ch[1] = vector<int>(2*n, -INF); vector<int> state(2*n, 0); for(int i = 0; i<numLvl; i++){ for(int j = 0; j<num[i].size(); j++) num[i][j] = label++; } for(int i = 0; i<numLvl-1; i++){ int cur = 0; for(int j = 0; j<num[i].size(); j++){ if(cur >= num[i+1].size()-1){ ch[0][num[i][j]] = 1; ch[1][num[i][j]] = num[i+1][cur]; continue; } ch[0][num[i][j]] = num[i+1][cur++]; ch[1][num[i][j]] = num[i+1][cur++]; } } if(n%2 == 1){ ch[0][label-1] = 1; } for(int i = 0; i<n; i++){ int v = 1; while(ch[state[v]][v] != -INF){ int t = v; v = ch[state[v]][v]; state[t] = 1-state[t]; } ch[state[v]][v] = -events[i]; state[v] = 1-state[v]; } vector<int> C(m+1); for(int i = 0; i<=m; i++){ C[i] = -1; } vector<int> X, Y; for(int i = 1; i<label; i++){ X.push_back(-ch[0][i]); Y.push_back(-ch[1][i]); } answer(C, X, Y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 54 ms | 5572 KB | Output is correct |
3 | Correct | 53 ms | 5164 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 1356 KB | Output is correct |
6 | Correct | 74 ms | 7356 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 54 ms | 5572 KB | Output is correct |
3 | Correct | 53 ms | 5164 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 1356 KB | Output is correct |
6 | Correct | 74 ms | 7356 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 121 ms | 8688 KB | Output is correct |
9 | Correct | 101 ms | 9072 KB | Output is correct |
10 | Correct | 158 ms | 13212 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 | 54 ms | 5572 KB | Output is correct |
3 | Correct | 53 ms | 5164 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 12 ms | 1356 KB | Output is correct |
6 | Correct | 74 ms | 7356 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 121 ms | 8688 KB | Output is correct |
9 | Correct | 101 ms | 9072 KB | Output is correct |
10 | Correct | 158 ms | 13212 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 | 152 ms | 12732 KB | Output is correct |
15 | Correct | 133 ms | 8300 KB | Output is correct |
16 | Correct | 139 ms | 12696 KB | Output is correct |
17 | Correct | 2 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 | 157 ms | 12968 KB | Output is correct |
21 | Correct | 2 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 93 ms | 7904 KB | Output is correct |
3 | Correct | 91 ms | 7912 KB | Output is correct |
4 | Correct | 159 ms | 11924 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 93 ms | 7904 KB | Output is correct |
3 | Correct | 91 ms | 7912 KB | Output is correct |
4 | Correct | 159 ms | 11924 KB | Output is correct |
5 | Correct | 156 ms | 12456 KB | Output is correct |
6 | Correct | 165 ms | 12200 KB | Output is correct |
7 | Correct | 143 ms | 12320 KB | Output is correct |
8 | Correct | 136 ms | 12088 KB | Output is correct |
9 | Correct | 93 ms | 7916 KB | Output is correct |
10 | Correct | 143 ms | 12080 KB | Output is correct |
11 | Correct | 134 ms | 11956 KB | Output is correct |
12 | Correct | 106 ms | 8012 KB | Output is correct |
13 | Correct | 94 ms | 8168 KB | Output is correct |
14 | Correct | 100 ms | 8160 KB | Output is correct |
15 | Correct | 97 ms | 8296 KB | Output is correct |
16 | Correct | 3 ms | 588 KB | Output is correct |
17 | Correct | 84 ms | 8248 KB | Output is correct |
18 | Correct | 92 ms | 7908 KB | Output is correct |
19 | Correct | 100 ms | 8016 KB | Output is correct |
20 | Correct | 134 ms | 12072 KB | Output is correct |
21 | Correct | 163 ms | 11944 KB | Output is correct |
22 | Correct | 137 ms | 11956 KB | Output is correct |