# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
944126 | 2024-03-12T08:46:10 Z | shoryu386 | 자동 인형 (IOI18_doll) | C++17 | 136 ms | 16556 KB |
#include <bits/stdc++.h> using namespace std; int ptr = -1; vector<int> xLead, yLead; #include "doll.h" int construct(vector<int> item){ if (item.size() == 1){ return item[0]; } vector<int> itemLeft, itemRight; for (int x = 0; x < item.size(); x+=2){ itemLeft.push_back(item[x]); } for (int x = 1; x < item.size(); x+=2){ itemRight.push_back(item[x]); } int curNode = ptr; //cerr << "Construct " << curNode << '\n'; //for (auto y : item) cerr << y << ' '; //cerr << '\n'; ptr--; if (itemLeft.size() > itemRight.size()){ itemRight.insert(itemRight.begin(), curNode); swap(itemLeft, itemRight); } xLead[-curNode - 1] = ( construct(itemLeft) ); yLead[-curNode - 1] = ( construct(itemRight) ); return curNode; } void create_circuit(int m, std::vector<int> A) { int n = A.size(); xLead.clear(); yLead.clear(); xLead.resize(2*n + 100); yLead.resize(2*n + 100); ptr = -1; vector<int> leads[m+1]; leads[0].push_back(A[0]); for (int x = 0; x < n-1; x++){ leads[A[x]].push_back(A[x+1]); } leads[A[n-1]].push_back(0); vector<int> connection(m+1); for (int x = 0; x <= m; x++){ if (leads[x].size() == 0){ connection[x] = x; } else if (leads[x].size() == 1){ connection[x] = leads[x][0]; } else{ //construct binary tree connection[x] = construct(leads[x]); } //cerr << "leads " << x << '\n'; //for (auto y : leads[x]){ // cerr << y << ' '; //} //cerr << '\n'; } xLead.resize(-ptr - 1); yLead.resize(-ptr - 1); answer(connection, xLead, yLead); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 20 ms | 7516 KB | Output is correct |
3 | Correct | 16 ms | 6236 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 9 ms | 3932 KB | Output is correct |
6 | Correct | 24 ms | 9304 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 20 ms | 7516 KB | Output is correct |
3 | Correct | 16 ms | 6236 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 9 ms | 3932 KB | Output is correct |
6 | Correct | 24 ms | 9304 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 45 ms | 8784 KB | Output is correct |
9 | Correct | 42 ms | 10324 KB | Output is correct |
10 | Correct | 58 ms | 13136 KB | Output is correct |
11 | Correct | 1 ms | 600 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 20 ms | 7516 KB | Output is correct |
3 | Correct | 16 ms | 6236 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 9 ms | 3932 KB | Output is correct |
6 | Correct | 24 ms | 9304 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 45 ms | 8784 KB | Output is correct |
9 | Correct | 42 ms | 10324 KB | Output is correct |
10 | Correct | 58 ms | 13136 KB | Output is correct |
11 | Correct | 1 ms | 600 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 79 ms | 12940 KB | Output is correct |
15 | Correct | 41 ms | 8020 KB | Output is correct |
16 | Correct | 64 ms | 12116 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 600 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 69 ms | 14056 KB | Output is correct |
21 | Correct | 0 ms | 344 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | Output is partially correct |
2 | Correct | 47 ms | 7532 KB | Output is correct |
3 | Partially correct | 82 ms | 11708 KB | Output is partially correct |
4 | Partially correct | 87 ms | 13380 KB | Output is partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | Output is partially correct |
2 | Correct | 47 ms | 7532 KB | Output is correct |
3 | Partially correct | 82 ms | 11708 KB | Output is partially correct |
4 | Partially correct | 87 ms | 13380 KB | Output is partially correct |
5 | Partially correct | 102 ms | 15496 KB | Output is partially correct |
6 | Partially correct | 114 ms | 15892 KB | Output is partially correct |
7 | Partially correct | 109 ms | 15768 KB | Output is partially correct |
8 | Partially correct | 136 ms | 16196 KB | Output is partially correct |
9 | Partially correct | 105 ms | 10492 KB | Output is partially correct |
10 | Partially correct | 122 ms | 16556 KB | Output is partially correct |
11 | Partially correct | 125 ms | 16344 KB | Output is partially correct |
12 | Partially correct | 81 ms | 10524 KB | Output is partially correct |
13 | Partially correct | 74 ms | 10404 KB | Output is partially correct |
14 | Partially correct | 71 ms | 10336 KB | Output is partially correct |
15 | Partially correct | 65 ms | 10416 KB | Output is partially correct |
16 | Partially correct | 2 ms | 604 KB | Output is partially correct |
17 | Partially correct | 67 ms | 9008 KB | Output is partially correct |
18 | Partially correct | 72 ms | 9252 KB | Output is partially correct |
19 | Partially correct | 69 ms | 9384 KB | Output is partially correct |
20 | Partially correct | 91 ms | 12740 KB | Output is partially correct |
21 | Partially correct | 109 ms | 14392 KB | Output is partially correct |
22 | Partially correct | 89 ms | 11908 KB | Output is partially correct |