제출 #1173739

#제출 시각아이디문제언어결과실행 시간메모리
1173739somefolkArranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <complex>
#include <list>
#include <cassert>
#include <chrono>
#include <random>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define endl "\n"
// #define int long long

const int INF = 1e9+7;
const int MOD = 1e9+7;

int64_t count_swaps(vector<int> a){
    int n = a.size();

    if(n == 1){
        if(a[1] < a[0]) return 1;
        else return 0;
    }
    vector<int> pos, neg;
    for(int i = 0; i < n; i++){
        if(a[i] > 0 && i%2==0) pos.push_back(i);
        else if(a[i] < 0 && i%2!=0) neg.push_back(i);
    }

    int sol = 0, idx = 0;
    if(pos.size() < neg.size()){
        for(auto &i : pos){
            sol += abs(i-neg[idx]);
            idx++;
        }
    } else {
        for(auto &i : neg){
            sol += abs(i-pos[idx]);
            idx++;
        }
    }
    return sol;
}

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while(t--) cout << count_swaps({-2, 2, 2, -2, -2, 2});
    return 0;
}

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

/usr/bin/ld: /tmp/ccNy1EXh.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc2UMStT.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status