Submission #1314923

#TimeUsernameProblemLanguageResultExecution timeMemory
1314923exoworldgdMiners (IOI07_miners)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize("O5,unroll-loops,inline,fast-math")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#define int long long
#define exoworldgd cin.tie(0)->sync_with_stdio(0),cout.tie(0)
using namespace std;
int get(char c) {return c=='M'?1:c=='F'?2:c=='B'?3:0;}
int cnt(int a, int b, int c) {
    set<int> s;
    if (a > 0) s.insert(a);
    if (b > 0) s.insert(b);
    if (c > 0) s.insert(c);
    return s.size();
}
int dp[2][4][4][4][4],n,curr,nxt,ans=0;
signed main(void) {
    exoworldgd;
    string s;
    cin >> n >> s, memset(dp,-1,sizeof(dp)),dp[0][0][0][0][0] = 0;
    for (char c : s) {
        curr = get(c),nxt = 1-nxt,memset(dp[nxt],-1,sizeof(dp[nxt]));
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                for (int l = 0; l < 4; l++) {
                    for (int m = 0; m < 4; m++) {
                        if (dp[nxt^1][j][k][l][m] == -1) continue;
                        dp[nxt][k][curr][l][m] = max(dp[nxt][k][curr][l][m],dp[nxt^1][j][k][l][m]+cnt(j,k,curr)), dp[nxt][j][k][m][curr] = max(dp[nxt][j][k][m][curr],dp[nxt^1][j][k][l][m]+cnt(l,m,curr));
                    }
                }
            }
        }
    }
    for (int j = 0; j < 4; j++) for (int k = 0; k < 4; k++) for (int l = 0; l < 4; l++) for (int m = 0; m < 4; m++) if (dp[nxt][j][k][l][m]^-1) ans = max(ans,dp[nxt][j][k][l][m]);
    cout << ans;
}

Compilation message (stderr)

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from miners.cpp:3:
/usr/include/c++/13/bits/allocator.h: In destructor 'constexpr std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/basic_string.h:181:14: note: called from here
  181 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~