Submission #387820

#TimeUsernameProblemLanguageResultExecution timeMemory
387820MilosMilutinovicGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
/** * author: milos * created: 09.04.2021 10:49:32 **/ #include <bits/stdc++.h> using namespace std; int valid(int n, int* a) { set<int> s; for (int i = 0; i < n; i++) { a[i] %= n; if (a[i] == 0) { a[i] = n; } s.insert(a[i]); } if (s.size() != n) { return 0; } int cnt = 0; for (int i = 1; i < n; i++) { if (a[i] < a[i - 1]) { cnt++; } } return (cnt <= 1 ? 1 : 0); }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:16: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |   if (s.size() != n) {
      |       ~~~~~~~~~^~~~
/tmp/ccfNq7wu.o: In function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status