제출 #1237491

#제출 시각아이디문제언어결과실행 시간메모리
1237491IrateArt Collections (BOI22_art)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "art.h" using namespace std; const int mxN = 4005; vector<int>ANS, pos; int n, QUERY = 0, hist[mxN][mxN]; int publish(vector<int>R); // { // QUERY++; // int I = 0; // for(int i = 0;i < n;++i){ // for(int j = i + 1;j < n;++j){ // I += (pos[R[i]] > pos[R[j]]); // } // } // return I; // } void answer(vector<int>R); // { // for(int i = 0;i < n;++i){ // if(R[i] != ANS[i]){ // cout << "ERRRR" << endl; // return; // } // } // } bool cmp(int a, int b){ if(hist[a][b] != -1)return hist[a][b]; vector<int>temp; for(int i = 1;i <= n;++i){ if(i == a || i == b)continue; temp.push_back(i); } temp.push_back(a); temp.push_back(b); int I = publish(temp); swap(temp[n - 2], temp[n - 1]); int D = I - publish(temp); int ans = !(D > 0); hist[a][b] = ans; hist[b][a] = !ans; if(D > 0)return ans; return ans; } vector<int>gen(int n){ vector<int>perm(n); for(int i = 1;i <= n;++i){ perm[i - 1] = i; } for(int i = 0;i < 100;++i){ int a = rand() % n; int b = rand() % n; swap(perm[a], perm[b]); } return perm; } int main(){ srand(time(0)); ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; ANS = gen(n); pos.resize(n + 1); for(int i = 0;i < mxN;++i){ for(int j = 0;j < mxN;++j){ hist[i][j] = -1; } } for(int i = 0;i < n;++i){ pos[ANS[i]] = i; } vector<int>v(n); for(int i = 1;i <= n;++i){ v[i - 1] = i; } sort(v.begin(), v.end(), cmp); answer(v); // cout << '\n'; // cout << QUERY << '\n'; }

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

/usr/bin/ld: /tmp/ccMgTMjJ.o: in function `main':
interface.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccviRZbk.o:art.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccMgTMjJ.o: in function `main':
interface.cpp:(.text.startup+0x16): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status