Submission #717772

# Submission time Handle Problem Language Result Execution time Memory
717772 2023-04-02T13:47:02 Z Rafi22 The Collection Game (BOI21_swaps) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
#include "swaps.h"

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

const int N=507;

void solve(int n,int v)
{
    vector<vector<pair<int,int>>>res;
    vector<pair<int,int>>V;
    vector<int>ans(n);
    for(int i=0;i<n;i++) ans[i]=i+1;
    V.pb({1,n});
    while(sz(V)>0)
    {
        vector<pair<int,int>>X;
        vector<vector<pair<int,int>>>T;
        for(auto [l,r]:V) X.pb({l,r});
        while(sz(X)>0)
        {
            vector<pair<int,int>>nX,t;
            for(auto [l,r]:X)
            {
                int m=(l+r)/2;
                if(l<m) nX.pb({l,m});
                if(m+1<r) nX.pb({m+1,r});
                for(int i=0; m-i>=l&&m+i+1<=r;i++) t.pb({m-i,m+i+1});
            }
            T.pb(t);
            X=nX;
        }
        reverse(all(T));
        for(auto x:T) res.pb(x);
        vector<pair<int,int>>nV;
        for(auto [l,r]:V)
        {
            int m=(l+r)/2;
            if(l<m) nV.pb({l,m});
            if(m+1<r) nV.pb({m+1,r});
        }
        V=nV;
    }
    for(auto x:res)
    {
        for(auto [a,b]:x) schedule(a,b);
        vector<int>A=visit();
        int it=0;
        for(auto [a,b]:x)
        {
            if(A[it]==0) swap(ans[a],ans[b]);
            it++;
        }
    }
    answer(ans);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:30:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |         for(auto [l,r]:V) X.pb({l,r});
      |                  ^
swaps.cpp:34:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   34 |             for(auto [l,r]:X)
      |                      ^
swaps.cpp:47:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   47 |         for(auto [l,r]:V)
      |                  ^
swaps.cpp:57:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   57 |         for(auto [a,b]:x) schedule(a,b);
      |                  ^
swaps.cpp:60:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   60 |         for(auto [a,b]:x)
      |                  ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -