제출 #303557

#제출 시각아이디문제언어결과실행 시간메모리
303557vipghn2003Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "shoes.h"
using namespace std;

const int N=1e5+5;
int n;

int count_swaps(vector<int>a)
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    n=a.size();
    int res=0;
    for(int i=0;i<n;i+=2)
    {
        int id;
        for(int j=2;j<=n;j++)
        {
            if(a[j]==-a[i])
            {
                id=j;
                break;
            }
        }
        for(int j=id;j>i+1;j--)
        {
            res++;
            swap(a[j],a[j-1]);
        }
        if(a[i]>0) res++;
    }
    cout<<res;
}

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

shoes.cpp:8:5: error: ambiguating new declaration of 'int count_swaps(std::vector<int>)'
    8 | int count_swaps(vector<int>a)
      |     ^~~~~~~~~~~
In file included from shoes.cpp:2:
shoes.h:7:11: note: old declaration 'long long int count_swaps(std::vector<int>)'
    7 | long long count_swaps(std::vector<int> S);
      |           ^~~~~~~~~~~
shoes.cpp: In function 'int count_swaps(std::vector<int>)':
shoes.cpp:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^