| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 124508 | TuGSGeReL | Mechanical Doll (IOI18_doll) | C++17 | 123 ms | 19392 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back()
#define ss second
#define ff first
#define mt make_tuple
#define pof pop_front()
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
int st[200001];
void create_circuit(int M, vector<int> A) {
A.pub(0);
vector<int> C(M + 1);
set<int> ext;
for (int i = 1; i <= M; i++)
C[i] = -1;
C[0] = A[0];
ext.insert(1);
vector<int> X, Y;
X.pub(1e9);
Y.pub(1e9);
while (ext.size() * 2 < A.size() - 1 || pow(2, (int)log2(ext.size())) != ext.size() )
{
auto it = ext.begin();
while ( X.size() < *it )
X.pub(1e9), Y.pub(1e9);
X[*it - 1] = -(*it * 2);
Y[*it - 1] = -(*it * 2 + 1);
ext.insert(*it * 2);
ext.insert(*it * 2 + 1);
while ( *it * 2 + 1 > X.size() )
{
X.pub(1e9);
Y.pub(1e9);
}
ext.erase(it);
}
int num = 0, u = 0, z = 1, p = 2 * ext.size() - (A.size() - 1);
while ( num < ext.size() * 2 )
{
if ( (X[u] == 1e9 && !st[u]) || (Y[u] == 1e9 && st[u]) )
{
if ( z < A.size() && !p )
{
if ( !st[u] )
{
X[u] = A[z++];
st[u] = 1;
} else
{
Y[u] = A[z++];
st[u] = 0;
}
} else {
if ( !st[u] )
{
X[u] = -1;
st[u] = 1;
} else
{
Y[u] = -1;
st[u] = 0;
}
p--;
}
u = 0;
num++;
} else {
if ( st[u] )
{
st[u] ^= 1;
u = -Y[u] - 1;
} else
st[u] ^= 1, u = -X[u] - 1;
}
}
// for (auto x : C)
// cout << x << " ";
//
// cout << "\n";
//
// for (auto x : X)
// cout << x << " ";
//
// cout << "\n";
//
// for (auto x : Y)
// cout << x << " ";
//
// cout << "\n";
answer(C, X, Y);
} 컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
