Submission #1365887

#TimeUsernameProblemLanguageResultExecution timeMemory
1365887enzyThe Collection Game (BOI21_swaps)C++20
Compilation error
0 ms0 KiB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include<bits/stdc++.h>
#include "swaps.h"
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;

void solve(int n, int Q){
    vector<pii>v[20];
    for(int i=0;i<9;i++){
        vector<int>marc(n+1,0);
        for(int j=1;j+(1<<i)<=n;j++){
            if(marc[j]) v[2*i+1].push_back({j,j+(1<<i)});
            else{
                v[2*i].push_back({j,j+(1<<i)});
                marc[j]=marc[j+(1<<i)]=1;
            }
        }
    }
    for(int i=0;i<20;i++){
        for(pii p : v[i]) schedule(p.fi,p.se);
        vector<int>a=visit();
    }
    for(int i=1;i<=n;i++) ans.push_back(i);
    answer(ans);
}

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:33:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |     for(int i=1;i<=n;i++) ans.push_back(i);
      |                           ^~~
      |                           abs
swaps.cpp:34:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     answer(ans);
      |            ^~~
      |            abs