Submission #538287

#TimeUsernameProblemLanguageResultExecution timeMemory
538287timreizinLinear Garden (IOI08_linear_garden)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,pocnt,lzcnt") #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <array> #include <set> #include <string> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; bool check(string s) { #pragma GCC ivdep for (int i = 0; i < s.size(); ++i) { int cntL = 0; for (int l = 1; i + l - 1 < s.size(); ++l) { cntL += s[i + l - 1] == 'L'; int cntP = l - cntL; if (abs(cntP - cntL) > 2) return false; } } return true; } int main() { cin.tie(0)->sync_with_stdio(0); int n; ll m; string s; cin >> n >> m >> s; vector<string> gardens; #pragma GCC ivdep for (ll i = 0; i < (1 << n); ++i) { string s(n, 'L'); #pragma GCC ivdep for (int j = 0; j < n; ++j) if (i & (1 << j)) s[j] = 'P'; if (check(s)) gardens.push_back(s); } sort(gardens.begin(), gardens.end()); for (int i = 0; i < gardens.size(); ++i) { if (gardens[i] == s) { cout << (i + 1) % m; break; } } return 0; }

Compilation message (stderr)

cc1plus: error: attribute 'pocnt' argument 'target' is unknown
linear_garden.cpp: In function 'bool check(std::string)':
linear_garden.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < s.size(); ++i)
      |                     ~~^~~~~~~~~~
linear_garden.cpp:24:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for (int l = 1; i + l - 1 < s.size(); ++l)
      |                         ~~~~~~~~~~^~~~~~~~~~
linear_garden.cpp: In function 'int main()':
linear_garden.cpp:51:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |     for (int i = 0; i < gardens.size(); ++i)
      |                     ~~^~~~~~~~~~~~~~~~