제출 #363944

#제출 시각아이디문제언어결과실행 시간메모리
363944Fysty자동 인형 (IOI18_doll)C++17
6 / 100
202 ms17500 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define MottoHayaku ios::sync_with_stdio(0);cin.tie(0); #define rep1(i,n) for(int i=1;i<=n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define F first #define S second #define pb push_back //#define int ll const int MOD=1e9+7; const ll INF=1e16; const int N=100005; const int maxN=1e6; vector<int> ed[N]; ll t=0,x[maxN],y[maxN]; void get_switch(vector<int> v,int par,bool side,vector<int> &c) { if(v.size()==0) return; if(v.size()==1) { if(par>=0) c[par]=v[0]; else { if(!side) x[-par]=v[0]; else y[-par]=v[0]; } return; } vector<int> l,r; if(v.size()%2==1) { t--; x[-t]=t; y[-t]=t-1; l.pb(t); rep(i,v.size()) { if(i&1) l.pb(v[i]); else r.pb(v[i]); } } else { rep(i,v.size()) { if(i&1) r.pb(v[i]); else l.pb(v[i]); } } t--; if(par>=0) { c[par]=t; } else { if(!side) x[-par]=t; else y[-par]=t; } int cur=t; get_switch(l,cur,0,c); get_switch(r,cur,1,c); } void answer(vector<int> c,vector<int> x,vector<int> y); void create_circuit(int M,vector<int> A) { vector<int> c(M+1,0); ll cur=0; A.pb(0); rep(i,A.size()) { ed[cur].pb(A[i]); cur=A[i]; } rep(i,M+1) get_switch(ed[i],i,0,c); vector<int> X,Y; t=-t; rep1(i,t) { X.pb(x[i]); Y.pb(y[i]); } //rep(i,c.size()) cout<<i<<": "<<c[i]<<"\n"; //rep(i,X.size()) cout<<-(i+1)<<": "<<X[i]<<" "<<Y[i]<<"\n"; answer(c,X,Y); }

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

doll.cpp: In function 'void get_switch(std::vector<int>, int, bool, std::vector<int>&)':
doll.cpp:7:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i,n) for(int i=0;i<n;i++)
......
   38 |         rep(i,v.size())
      |             ~~~~~~~~~~         
doll.cpp:38:9: note: in expansion of macro 'rep'
   38 |         rep(i,v.size())
      |         ^~~
doll.cpp:7:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i,n) for(int i=0;i<n;i++)
......
   46 |         rep(i,v.size())
      |             ~~~~~~~~~~         
doll.cpp:46:9: note: in expansion of macro 'rep'
   46 |         rep(i,v.size())
      |         ^~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:7:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i,n) for(int i=0;i<n;i++)
......
   72 |     rep(i,A.size())
      |         ~~~~~~~~~~             
doll.cpp:72:5: note: in expansion of macro 'rep'
   72 |     rep(i,A.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...