제출 #694846

#제출 시각아이디문제언어결과실행 시간메모리
694846allin27xArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int res = 0;
    int n; cin>>n;
    vector<int> s(n,0);
    for (int i=0; i<n; i++) cin>>s[i];
    vector<bool> ac(n,1);
    for (int i=0; i<n; i++){
        if (!ac[i]) continue;
        for (int j=i+1; j<n; j++){
            if (!ac[j] || abs(s[j])!=abs(s[i])) continue;
            ac[j] = 0;
            ac[i] = 0;
            if (s[i]<0) res+=j-i-1; else res+=j-i; break;
        }
    }
    cout<<res<<'\n';

    return 0;
}

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

/usr/bin/ld: /tmp/cctfIDFw.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc4B2i3y.o:shoes.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cctfIDFw.o: in function `main':
grader.cpp:(.text.startup+0x2a8): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status