답안 #1032471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032471 2024-07-23T20:10:15 Z Ludissey 자동 인형 (IOI18_doll) C++14
0 / 100
1 ms 436 KB
#include "doll.h"
#include <bits/stdc++.h>
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
using namespace std;

void create_circuit(int M, std::vector<int> A){
    int N=sz(A);
    if(N==16){
        vector<int> C(M+1,0);
        vector<vector<int>> nxt(M+1);
        vector<int> X;
        vector<int> Y;
        for (int i = 1; i < N; i++)
        {
            nxt[A[i-1]].push_back(A[i]);
        }
        nxt[A[N-1]].push_back(0);
        C[0]=A[0];
        int trig=-1;
        for (int i = 1; i <= M; i++)
        {
            if(sz(nxt[i])==0) continue;
            if(sz(nxt[i])<=1){
                C[i]=nxt[i][0];
            }else if(sz(nxt[i])<=2){
                C[i]=trig;
                trig--;
                X.push_back(nxt[i][0]);
                Y.push_back(nxt[i][1]);
            }else if(sz(nxt[i])<=4){
                C[i]=trig;
                X.push_back(trig-1);
                Y.push_back(trig-2);
                X.push_back(nxt[i][0]);
                X.push_back(nxt[i][1]);
                if(sz(nxt[i])==3) {
                    Y.push_back(trig);
                    Y.push_back(nxt[i][2]);
                }
                else {
                    Y.push_back(nxt[i][2]);
                    Y.push_back(nxt[i][3]);
                }
                trig-=3;
            }else if(sz(nxt[i])<=8){
                C[i]=trig;
                X.push_back(trig-1);
                Y.push_back(trig-2);
                X.push_back(trig-3);
                Y.push_back(trig-4);
                X.push_back(trig-5);
                Y.push_back(trig-6);
                X.push_back(nxt[i][0]);
                X.push_back(nxt[i][2]);
                X.push_back(nxt[i][1]);
                X.push_back(nxt[i][3]);
                if(sz(nxt[i])==8) {
                    Y.push_back(nxt[i][4]);
                    Y.push_back(nxt[i][6]);
                    Y.push_back(nxt[i][5]);
                    Y.push_back(nxt[i][7]);
                }else if(sz(nxt[i])==7) {
                    Y.push_back(nxt[i][4]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][5]);
                    Y.push_back(nxt[i][6]);
                }else if(sz(nxt[i])==6){
                    Y.push_back(nxt[i][4]);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][5]);
                }else{
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][4]);
                }
                trig-=7;
            }else if(sz(nxt[i])<=16){
                C[i]=trig;
                X.push_back(trig-1);
                Y.push_back(trig-2);
                X.push_back(trig-3);
                Y.push_back(trig-4);
                X.push_back(trig-5);
                Y.push_back(trig-6);

                X.push_back(trig-7);
                Y.push_back(trig-8);
                X.push_back(trig-9);
                Y.push_back(trig-10);
                X.push_back(trig-11);
                Y.push_back(trig-12);
                X.push_back(trig-13);
                Y.push_back(trig-14);

                X.push_back(nxt[i][0]);
                X.push_back(nxt[i][4]);
                X.push_back(nxt[i][2]);
                X.push_back(nxt[i][6]);

                X.push_back(nxt[i][1]);
                X.push_back(nxt[i][5]);
                X.push_back(nxt[i][3]);
                X.push_back(nxt[i][7]);


                if(sz(nxt[i])==16) {
                    Y.push_back(nxt[i][8]);
                    Y.push_back(nxt[i][12]);
                    Y.push_back(nxt[i][10]);
                    Y.push_back(nxt[i][14]);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(nxt[i][13]);
                    Y.push_back(nxt[i][11]);
                    Y.push_back(nxt[i][15]);
                }else if(sz(nxt[i])==15) {
                    Y.push_back(nxt[i][8]);
                    Y.push_back(nxt[i][12]);
                    Y.push_back(nxt[i][10]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(nxt[i][13]);
                    Y.push_back(nxt[i][11]);
                    Y.push_back(nxt[i][14]);
                }else if(sz(nxt[i])==14){
                    Y.push_back(nxt[i][8]);
                    Y.push_back(nxt[i][12]);
                    Y.push_back(nxt[i][10]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][11]);
                    Y.push_back(nxt[i][13]);
                }else if(sz(nxt[i])==13){
                    Y.push_back(nxt[i][8]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][10]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][11]);
                    Y.push_back(nxt[i][12]);
                }else if(sz(nxt[i])==12){
                    Y.push_back(nxt[i][8]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][10]);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][11]);
                }else if(sz(nxt[i])==11){
                    Y.push_back(nxt[i][8]);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][10]);
                }else if(sz(nxt[i])==10){
                    Y.push_back(nxt[i][8]);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][9]);
                }else if(sz(nxt[i])==9){
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(trig);
                    Y.push_back(nxt[i][8]);
                }
                trig-=15;
            }
        }
        for (int i = 0; i <= M; i++)
        {
            //cerr << C[i] << " ";
        }
        //cerr<<"\n";
        for (int i = 0; i < sz(Y); i++){
            //cerr << X[i] << " " << Y[i] << "\n";
        }

        answer(C,{X},{Y});
    }else{
        answer({},{},{});
        
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 436 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 436 KB Wrong Answer: wrong array length
2 Halted 0 ms 0 KB -