Submission #580737

#TimeUsernameProblemLanguageResultExecution timeMemory
580737vladiliusArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int count_swaps(int l[], int n){
    if (n == 2){
        if (l[0] < l[1]){
            return 0;
        }
        else {
            return 1;
        }
    }
}

int main(){
    int n; cin>>n;
    int l[n]; 
    for (int i = 0; i < n; i++){
        cin>>l[i];
    }
    cout<<count_swaps(l, n);
}

Compilation message (stderr)

shoes.cpp: In function 'int count_swaps(int*, int)':
shoes.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
/usr/bin/ld: /tmp/ccI3e4Sw.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccR5rn2w.o:shoes.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccI3e4Sw.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