Submission #105079

#TimeUsernameProblemLanguageResultExecution timeMemory
105079WLZGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include "gondola.h" #include <bits/stdc++.h> int valid(int n, int inputSeq[]) { int pos = -1; set<int> used; for (int i = 0; i < n; i++) { if (inputSeq[i] <= n) { pos = i; break; } } if (pos == -1) { return 1; } int cur = inputSeq[pos] - pos; if (cur < 1) { cur = n - cur; } for (int i = 0; i < n; i++) { if (inputSeq[i] <= n && inputSeq[i] != cur) { return 0; } if (used.count(inputSeq[i])) { return 0; } used.insert(inputSeq[i]); cur++; if (cur > n) { cur = 1; } } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:6:3: error: 'set' was not declared in this scope
   set<int> used;
   ^~~
gondola.cpp:6:3: note: suggested alternative:
In file included from /usr/include/c++/7/set:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from gondola.cpp:2:
/usr/include/c++/7/bits/stl_set.h:93:11: note:   'std::set'
     class set
           ^~~
gondola.cpp:6:7: error: expected primary-expression before 'int'
   set<int> used;
       ^~~
gondola.cpp:24:9: error: 'used' was not declared in this scope
     if (used.count(inputSeq[i])) {
         ^~~~
gondola.cpp:27:5: error: 'used' was not declared in this scope
     used.insert(inputSeq[i]);
     ^~~~