답안 #962565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962565 2024-04-13T20:10:49 Z BhavayGoyal Bali Sculptures (APIO15_sculpture) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T> using oset = 
            tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define ld long double
#define ar array
#define vi vector<int>
#define vii vector<vector<int>>
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define endl "\n"

const int MOD = 1e9+7;
const int inf = 1e9;
const int linf = 1e18;

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


// -------------------------------------------------- Main Code --------------------------------------------------

void sol() {
    int n, a, b; cin >> n >> a >> b;

    int arr[n+1];
    for (int i = 1; i <= n; i++) cin >> arr[i];

    function<void(int, int)> sol = [&](int idx, int left, int pref) {

    };

    if (a != 1) {
        int pref = 0;
        for (int k = 60; k >= 0; k--) {
            for (int i = a; i <= b; i++) {
                sol()
            }
        }
    }
    else {
        int pref = 0;
        for (int k = 60; k >= 0; k--) {
            int dpp[n+1]; dpp[0] = 0;
            for (int i = 1; i <= n; i++) {
                int sum = 0;
                dpp[i] = inf;
                for (int j = i; j >= 1; j--) {
                    sum += arr[j];
                    if (((pref>>k)|(sum>>k)) == (pref>>k))
                        dpp[i] = min(dpp[j-1]+1, dpp[i]);
                }
            }
            if (dpp[n] > b) pref |= (1ll<<k);
        }
        cout << pref << endl;
    }
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t; 
    while (t--) {
        sol();
    }
    return 0;
}

Compilation message

sculpture.cpp: In function 'void sol()':
sculpture.cpp:43:5: error: conversion from 'sol()::<lambda(long long int, long long int, long long int)>' to non-scalar type 'std::function<void(long long int, long long int)>' requested
   43 |     };
      |     ^
sculpture.cpp:49:21: error: no match for call to '(std::function<void(long long int, long long int)>) ()'
   49 |                 sol()
      |                     ^
In file included from /usr/include/c++/10/functional:59,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from sculpture.cpp:1:
/usr/include/c++/10/bits/std_function.h:617:5: note: candidate: '_Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = void; _ArgTypes = {long long int, long long int}]'
  617 |     function<_Res(_ArgTypes...)>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/std_function.h:617:5: note:   candidate expects 2 arguments, 0 provided
sculpture.cpp:46:13: warning: unused variable 'pref' [-Wunused-variable]
   46 |         int pref = 0;
      |             ^~~~