Submission #1011334

#TimeUsernameProblemLanguageResultExecution timeMemory
1011334kaopjMiners (IOI07_miners)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #define lgm cin.tie(0)->sync_with_stdio(0); using namespace std; #define int long long signed main() { lgm; int n; cin >> n; char c[n+1]; cin >> c; auto dfs = [&] (auto dfs,int p,vector<char> a,vector<char> b)->int { vector<char> ua=a,ub=b; int sa=0,sb=0; bool hm=0,hb=0,hf=0; ua[0]=ua[1]; ua[1]=ua[2]; ua[2]=c[p]; ub[0]=ub[1]; ub[1]=ub[2]; ub[2]=c[p]; for (int i=0;i<3;i++) { if (ua[i] == 'M') { sa+=1-hm; hm=1; } else if (ua[i] == 'B') { sa+=1-hb; hb=1; } else if (ua[i] == 'F') { sa+=1-hf; hf=1; } } hm=0; hb=0; hf=0; for (int i=0;i<3;i++) { if (ub[i] == 'M') { sb+=1-hm; hm=1; } else if (ub[i] == 'B') { sb+=1-hb; hb=1; } else if (ub[i] == 'F') { sb+=1-hf; hf=1; } } if (p == n-1) { return max(sa,sb); } return max(sa+dfs(dfs,p+1,ua,a),sb+dfs(dfs,p+1,a,sb)); }; cout << dfs(dfs,0,{' ',' ',' '},{' ',' ',' '}); return 0; }

Compilation message (stderr)

miners.cpp: In function 'int main()':
miners.cpp:12:16: error: use of deleted function 'main()::<lambda(auto:1, long long int, std::vector<char>, std::vector<char>)>::~<lambda>()'
   12 |     auto dfs = [&] (auto dfs,int p,vector<char> a,vector<char> b)->int {
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   13 |         vector<char> ua=a,ub=b;
      |         ~~~~~~~~~~~~~~~~~~~~~~~
   14 |         int sa=0,sb=0;
      |         ~~~~~~~~~~~~~~
   15 |         bool hm=0,hb=0,hf=0;
      |         ~~~~~~~~~~~~~~~~~~~~
   16 |         ua[0]=ua[1];
      |         ~~~~~~~~~~~~
   17 |         ua[1]=ua[2];
      |         ~~~~~~~~~~~~
   18 |         ua[2]=c[p];
      |         ~~~~~~~~~~~
   19 |         ub[0]=ub[1];
      |         ~~~~~~~~~~~~
   20 |         ub[1]=ub[2];
      |         ~~~~~~~~~~~~
   21 |         ub[2]=c[p];
      |         ~~~~~~~~~~~
   22 |         for (int i=0;i<3;i++) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~
   23 |             if (ua[i] == 'M') {
      |             ~~~~~~~~~~~~~~~~~~~
   24 |                 sa+=1-hm;
      |                 ~~~~~~~~~
   25 |                 hm=1;
      |                 ~~~~~
   26 |             } else if (ua[i] == 'B') {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
   27 |                 sa+=1-hb;
      |                 ~~~~~~~~~
   28 |                 hb=1;
      |                 ~~~~~
   29 |             } else if (ua[i] == 'F') {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                 sa+=1-hf;
      |                 ~~~~~~~~~
   31 |                 hf=1;
      |                 ~~~~~
   32 |             }
      |             ~   
   33 |         }
      |         ~       
   34 |         hm=0; hb=0; hf=0;
      |         ~~~~~~~~~~~~~~~~~
   35 |         for (int i=0;i<3;i++) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~
   36 |             if (ub[i] == 'M') {
      |             ~~~~~~~~~~~~~~~~~~~
   37 |                 sb+=1-hm;
      |                 ~~~~~~~~~
   38 |                 hm=1;
      |                 ~~~~~
   39 |             } else if (ub[i] == 'B') {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
   40 |                 sb+=1-hb;
      |                 ~~~~~~~~~
   41 |                 hb=1;
      |                 ~~~~~
   42 |             } else if (ub[i] == 'F') {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |                 sb+=1-hf;
      |                 ~~~~~~~~~
   44 |                 hf=1;
      |                 ~~~~~
   45 |             }
      |             ~   
   46 |         }
      |         ~       
   47 |         if (p == n-1) {
      |         ~~~~~~~~~~~~~~~
   48 |             return max(sa,sb);
      |             ~~~~~~~~~~~~~~~~~~
   49 |         }
      |         ~       
   50 |         return max(sa+dfs(dfs,p+1,ua,a),sb+dfs(dfs,p+1,a,sb));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 |     };
      |     ~           
miners.cpp:12:18: note: 'main()::<lambda(auto:1, long long int, std::vector<char>, std::vector<char>)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:
   12 |     auto dfs = [&] (auto dfs,int p,vector<char> a,vector<char> b)->int {
      |                  ^