답안 #75122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
75122 2018-09-08T12:24:03 Z faustaadp 자동 인형 (IOI18_doll) C++17
9 / 100
150 ms 20592 KB
#include "doll.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll i,Sa=0,DU[202020],j,TR;
vector<ll> v[202020],isi;
vector<int> C,XXI,YYI;
void gawe(ll aa,ll bb,ll cc,ll dd)
{
    //cout<<i<<" "<<aa<<" "<<bb<<" "<<cc<<"\n";
    if(aa==1)
    {
       // cout<<bb<<"\n";
        XXI[dd]=(isi[bb]);
        YYI[dd]=(isi[bb+(1<<(cc-1))]);
        return ;
    }
    TR++;
    XXI[dd]=-TR-1;
    gawe(aa-1,bb,cc,TR);
    TR++;
    YYI[dd]=-TR-1;
  //  cout<<i<<" "<<cc<<" "<<aa<<" "<<(1<<(cc-aa))<<"\n";
    gawe(aa-1,bb+(1<<(cc-aa)),cc,TR);
}
void create_circuit(int M, std::vector<int> A) {
    int N = A.size();
    for(i=0;i<=M;i++)
        C.pb(99);
    v[0].pb(A[i]);
    for(i=0;i<N-1;i++)
        v[A[i]].pb(A[i+1]);
    for(i=0;i<=200000;i++)
    {
        for(j=20;j>=0;j--)
        {
            ll HA=(1<<j);
            if(HA>=i)
                DU[i]=j;
        }
    }
    v[A[N-1]].pb(0);
    //return ;
    for(i=0;i<=M;i++)
    {
        if(v[i].size()==0)
            continue;
        else
        if(v[i].size()==1)
        {
            C[i]=v[i][0];
            continue;
        }
        else
        {
            C[i]=-TR-1;
            ll SZ=v[i].size();
            ll GED=DU[SZ];
            //cout<<SZ<<" "<<GED<<"\n";
            isi.clear();
           // cout<<GED<<"GED\n";
            for(j=0;j<((1<<GED)-SZ);j++)
                isi.pb(-TR-1);
            for(j=0;j<v[i].size();j++)
                isi.pb(v[i][j]);
            for(j=0;j<isi.size();j++)
            {
                XXI.pb(0);
                YYI.pb(0);
       //         cout<<j<<" "<<isi[j]<<"\n";
            }
            gawe(GED,0,GED,TR);
            //TR+=GED;
        }
    }
   // for(i=0;i<=M;i++)cout<<i<<" "<<C[i]<<"\n";
  //  for(i=0;i<XXI.size();i++)cout<<-i-1<<" "<<XXI[i]<<" "<<YYI[i]<<"\n";
  //  cout<<C.size()<<" "<<XXI.size()<<" "<<YYI.size()<<"\n";
    answer(C, XXI, YYI);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:68:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |             for(j=0;j<v[i].size();j++)
      |                     ~^~~~~~~~~~~~
doll.cpp:70:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |             for(j=0;j<isi.size();j++)
      |                     ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 6580 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 6580 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 6580 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 6588 KB wrong serial number
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 10 ms 6616 KB Output is partially correct
2 Correct 60 ms 13740 KB Output is correct
3 Partially correct 93 ms 19284 KB Output is partially correct
4 Partially correct 116 ms 20104 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 10 ms 6616 KB Output is partially correct
2 Correct 60 ms 13740 KB Output is correct
3 Partially correct 93 ms 19284 KB Output is partially correct
4 Partially correct 116 ms 20104 KB Output is partially correct
5 Incorrect 150 ms 20592 KB wrong motion
6 Halted 0 ms 0 KB -