Submission #1196031

#TimeUsernameProblemLanguageResultExecution timeMemory
1196031FIFI_cppA Light Inconvenience (CEOI23_light)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>

#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppi pair<int,pair<int,int>>
#define int int64_t
#define ll long long
using namespace std;

vector<int> positions;
int sz = 1;
void prepare(){
    positions.clear();
    positions = {1};
}

std::pair<long long, std::vector<long long>> join(long long p){
    sz += p;
    positions.clear();
    int x = 1;
    while (x <= sz)
    {
        positions.pb(sz - x + 1);
        x *= 2;
    }
    reverse(all(positions));
    pair<ll, vector<ll>> res = {p, positions};
	return res;
}

std::pair<long long, std::vector<long long>> leave(long long p){
    sz -= p;
    positions.clear();
    int x = 1;
    while (x <= sz)
    {
        positions.pb(sz - x + 1);
        x *= 2;
    }
    reverse(all(positions));
    pair<ll, vector<ll>> res = {p, positions};
    return res;
}

Compilation message (stderr)

light.cpp: In function 'std::pair<long long int, std::vector<long long int> > join(long long int)':
light.cpp:50:45: error: could not convert '{p, positions}' from '<brace-enclosed initializer list>' to 'std::pair<long long int, std::vector<long long int> >'
   50 |     pair<ll, vector<ll>> res = {p, positions};
      |                                             ^
      |                                             |
      |                                             <brace-enclosed initializer list>
light.cpp: In function 'std::pair<long long int, std::vector<long long int> > leave(long long int)':
light.cpp:64:45: error: could not convert '{p, positions}' from '<brace-enclosed initializer list>' to 'std::pair<long long int, std::vector<long long int> >'
   64 |     pair<ll, vector<ll>> res = {p, positions};
      |                                             ^
      |                                             |
      |                                             <brace-enclosed initializer list>