| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 418615 | FlippenFaz | 자동 인형 (IOI18_doll) | C++11 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> c;
vector<int> x;
vector<int> y;
void create_circuit(int m, vector<int> a) {
    c.resize(m+1, -1);
    vector<int> seen;
    seen.resize(m, false);
    c[0] = a[0];
    for (int i = 0; i < a.size(); i++) {
        seen[a[i]]++;
    }
    vector<int> newA;
    bool next = false;
    if (seenTwice[a[0]] > 1) { next = true;}
    for (int i = 1; i < a.size(); i++) {
        if (next) {
            newA.push_back(a[i]);
            next = false;
        } else {
            //cout << " a[i-1] a[i]" << endl;
            //cout << a[i-1] << " " << a[i] << endl;
            c[a[i-1]] = a[i];
        }
        if (seen[a[i]] > 1) {
            next = true;
        }
    }
    
   
    if (newA.size() > 0) {
    int maxPow = ceil(log2(newA.size()));
    if (maxPow = log2(newA.size())) {
        maxPow++;
    }
    newA.resize( pow(2,maxPow), -1 );
    newA.back() = 0;
    for (int j = 1; j < pow(2,maxPow); j++) {
        x.push_back(-j*2 );
        y.push_back(-j*2 - 1);
    }
    vector<int> ord;
    ord.push_back( pow(2,maxPow) );
    int curPow = pow(2,maxPow-1);
    while (curPow > 0) {
        int curSize = ord.size();
        for (int i = 0; i < curSize; i++) {
            ord.push_back(ord[i] - curPow);
        }
        curPow/=2;
    }
    int cnt = 0;
    for (int j = pow(2,maxPow)-2; j >= pow(2,maxPow-1)-1; j--) {
        y[j] = newA[ord[cnt++]-1];
        x[j] = newA[ord[cnt++]-1];
    }
    } else {
        x.push_back(-1);
        y.push_back(0);
    }
    answer(c,x,y);
    cerr<< "SIZE: " <<  x.size() << endl;
    for (int i = 0; i < c.size(); i++) {
        cerr << c[i] << endl;
    }
    for (int i = 0; i < x.size(); i++) {
        cerr << x[i] << " " << y[i] << endl;
    }  
}
