Submission #1291900

#TimeUsernameProblemLanguageResultExecution timeMemory
1291900lukaye_19Arranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(vector<long long>shoes) { long long n = shoes.size() / 2; bool samesize = true; bool leftrightshoes = true; for (long long i = 0; i < n * 2; i++) { long long a = shoes[i]; if (i != 0) { if (a + shoes[i - 1] == 0 || a + shoes[i - 1] == a * 2) samesize = false; } if ((i <= n - 1 && a > 0) || (i > n - 1 && i <= n * 2 - 1 && a < 0)) leftrightshoes = false; shoes[i] = a; } if (n == 1) { if (shoes[0] > shoes[1]) { return 1; } else { return 0; } } else if (samesize) { long long answer = 0; for (long long i = 0; i < n * 2; i += 2) { if (i % 2 == 0 && shoes[i] > 0) { answer++; } } return answer; } else if (leftrightshoes) { long long answer = 0; for (long long i = 0; i < n; i++) { answer += i; } return answer; } return 0LL; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccPXW22m.o: in function `main':
grader.cpp:(.text.startup+0x26b): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status