제출 #285662

#제출 시각아이디문제언어결과실행 시간메모리
285662Otaku619Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int count_swaps(int v[], int n) { int swa = 0; for (int i = 0; i < 2 * n; i += 2) { for (int j = i + 1; j < 2 * n; j++) { if (abs(v[j]) == abs(v[i])) { for (int k = j; k > i + 1; k--) swap(v[k], v[k - 1]); swa += (j - 1 - i); if (v[i + 1] < 0) { swap(v[i], v[i + 1]); swa++; } break; } } } return swa; } int main() { int n; cin >> n; int vect[2 * n]; for (int i = 0; i < 2 * n; i++) { int j; cin >> j; vect[i] = j; } // for(int i=0;i<2*n;i++) // cout<<vect[i]; cout << count_swaps(vect, n); return 0; }

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

/tmp/ccO5AQRv.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccrjPfao.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccO5AQRv.o: In function `main':
grader.cpp:(.text.startup+0x26a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status