제출 #333860

#제출 시각아이디문제언어결과실행 시간메모리
333860nicholask자동 인형 (IOI18_doll)C++14
컴파일 에러
0 ms0 KiB
//#include "doll.h" #include <bits/stdc++.h> using namespace std; void answer(vector <int> c,vector <int> x,vector <int> y){ cout<<"C: "; for (auto&i:c) cout<<i<<' '; cout<<endl; cout<<"X: "; for (auto&i:x) cout<<i<<' '; cout<<endl; cout<<"Y: "; for (auto&i:y) cout<<i<<' '; cout<<endl; return; } void create_circuit(int m,vector <int> a){ vector <int> c(m+1,0),x,y; int n=a.size(); a.push_back(0); if (n==16){ c[0]=a[0]; for (int i=0; i<n; i++) c[i]=-1; for (int i=1; i<=7; i++){ x.push_back(-1*(2*i)); y.push_back(-1*(2*i+1)); } for (int i=0; i<=15; i+=2){ x.push_back(a[i+1]); y.push_back(a[i+2]); } answer(c,x,y); return; } else { vector <int> nxt[m+1]; for (int i=0; i<n; i++){ nxt[a[i]].push_back(a[i+1]); } int cur=0; c[0]=a[0]; for (int i=1; i<=m; i++){ if (nxt[i].size()==1){ c[i]=nxt[i][0]; } else if (nxt[i].size()==2){ cur--; c[i]=cur; x.push_back(nxt[i][0]); y.push_back(nxt[i][1]); } else if (nxt[i].size()==3){ cur--; c[i]=cur; cur--; x.push_back(cur); cur--; y.push_back(cur); x.push_back(c[i]); y.push_back(nxt[i][1]); x.push_back(nxt[i][0]); y.push_back(nxt[i][2]); } else if (nxt[i].size()==4){ cur--; c[i]=cur; cur--; x.push_back(cur); cur--; y.push_back(cur); x.push_back(nxt[i][0]); y.push_back(nxt[i][2]); x.push_back(nxt[i][1]); y.push_back(nxt[i][3]); } } answer(c,x,y); return; } } int main(){ int n,m; cin>>m>>n; vector <int> a; for (int i=0; i<n; i++){ int t; cin>>t; a.push_back(t); } create_circuit(m,a); }

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

/usr/bin/ld: /tmp/ccRYZbIF.o: in function `answer(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x1f0): multiple definition of `answer(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'; /tmp/cchn5A9E.o:doll.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccRYZbIF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cchn5A9E.o:doll.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status