제출 #379417

#제출 시각아이디문제언어결과실행 시간메모리
379417autumn_eel자동 인형 (IOI18_doll)C++14
37 / 100
182 ms10728 KiB
#include "doll.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; static vector<int>rec(vector<int>v){ if(v.size()==2)return v; vector<int>a,b; rep(i,v.size()){ if(i%2==0)a.push_back(v[i]); else b.push_back(v[i]); } a=rec(a); b=rec(b); vector<int>ans; for(int i:a)ans.push_back(i); for(int i:b)ans.push_back(i); return ans; } void create_circuit(int M, std::vector<int> A) { A.push_back(0); int N = A.size(); int n=2;while(n<N)n<<=1; n>>=1; vector<int>C(M+1); vector<int>X(2*n-1),Y(2*n-1); vector<int>idx(2*n); rep(i,2*n)idx[i]=i; idx=rec(idx); for(int i=1;i<=2*n-1;i++){ if(i<=n-1){ X[i-1]=-(i*2); Y[i-1]=-(i*2+1); } else{ int d=i-n; int l=idx[2*d],r=idx[2*d+1]; if(l<N-1||l==2*n-1){ X[i-1]=A[l<N-1?l:N-1]; } else X[i-1]=-1; if(r<N-1||r==2*n-1){ Y[i-1]=A[r<N-1?r:N-1]; } else Y[i-1]=-1; } } rep(i,M+1)C[i]=-1; answer(C,X,Y); }

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

doll.cpp: In function 'std::vector<int> rec(std::vector<int>)':
doll.cpp:3:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define rep(i,n)for(int i=0;i<(n);i++)
      |                              ^
doll.cpp:9:2: note: in expansion of macro 'rep'
    9 |  rep(i,v.size()){
      |  ^~~
#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...