Submission #959149

# Submission time Handle Problem Language Result Execution time Memory
959149 2024-04-07T14:18:39 Z Kavelmydex Broken Device (JOI17_broken_device) C++17
Compilation error
0 ms 0 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()

const int NN = 200, OO = 1e9, mod = 1e9+7;

int mp[NN], ans[NN];
void Anna( int n, long long X, int K, int P[] ){
  memset(mp,0,sizeof(mp)); memset(ans,0,sizeof(ans));
  assert(n == 150);
  For(i,K){
      mp[P[i]] = 1;
  }
  vi v;
  For(i,60){
    if((1LL<<i) & X){
        v.pb(i);
    }
  }
  for(int i=0; i<=89; ++i){
    bool ok = 1;
    for(int j=i; j<=i+60; ++j){
        ok &= (!mp[j]);
    }
    if(ok){
        ans[i] = 1;
        for(int x: v){
            assert(i+x+1 < N);
            ans[i+x+1] = 1;
        }
        break;
    }
  }
  For(i,n){
    Set(i,ans[i]);
  }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()

long long Bruno( int N, int A[] ){
    int fi = 0;
    For(i,N){
        if(A[i]) {
            fi = i;
            break;
        }
    }
    ll ans = 0;
    for(int i=fi+1; i+59<N; ++i){
        if(A[i]){
            ans += (1LL<<(i-fi-1));
        }
    }
    return ans;
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from Anna.cpp:2:
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:40:28: error: 'N' was not declared in this scope
   40 |             assert(i+x+1 < N);
      |                            ^