제출 #101931

#제출 시각아이디문제언어결과실행 시간메모리
101931daniel920712자동 인형 (IOI18_doll)C++14
2 / 100
62 ms7076 KiB
#include "doll.h" #include <vector> #include <stdio.h> using namespace std; int con[1000005]={0}; int This[1000005]={0}; int m[1000005]; int n[1000005]; int start[1000005]={0}; vector < int > C,x,y; int X[1000005]={0}; int Y[1000005]={0}; int now=1; int t[1000005]={0}; int how[1000005]={0}; void build(int N,int one,int here,int what) { if(one==1) { Y[-here]=0; if(N==2) X[-here]=0; else X[-here]=what; } else { if(N<=one) X[-here]=what; else { X[-here]=(-now); now++; } Y[-here]=(-now); now++; if(N>one) { build(N-one,one/2,X[-here],what); build(one,one/2,Y[-here],what); } else build(N,one/2,Y[-here],what); } } void New(int here,int what) { //printf("%d ",here); if(how[-here]%2==0) { how[-here]++; if(X[-here]) New(X[-here],what); else X[-here]=what; } else { how[-here]++; if(Y[-here]) New(Y[-here],what); else Y[-here]=what; } } void create_circuit(int M, vector < int > A) { int N=A.size(),i,temp,t=1; C.push_back(A[0]); for(i=1;i<=M;i++) C.push_back(i); for(i=0;i<N;i++) con[A[i]]++; A.push_back(0); for(i=0;i<N;i++) { if(con[A[i]]==1) C[A[i]]=A[i+1]; else { if(!This[A[i]]) { C[A[i]]=-now; now++; temp=1; while(temp<con[A[i]]) temp*=2; build(con[A[i]],temp/2,C[A[i]],C[A[i]]); } This[A[i]]++; New(C[A[i]],A[i+1]); } } for(i=1;i<now;i++) printf("%d %d %d\n",-i,X[i],Y[i]); for(i=1;i<now;i++) x.push_back(X[i]); for(i=1;i<now;i++) y.push_back(Y[i]); answer(C,x,y); }

컴파일 시 표준 에러 (stderr) 메시지

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:62:27: warning: unused variable 't' [-Wunused-variable]
   62 |     int N=A.size(),i,temp,t=1;
      |                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...