Submission #313377

# Submission time Handle Problem Language Result Execution time Memory
313377 2020-10-15T22:46:20 Z ly20 Broken Device (JOI17_broken_device) C++17
Compilation error
0 ms 0 KB
#include "Annalib.h"

void Anna( int N, long long X, int K, int P[] ){
    bool rs[200], marc[200];
    int n = N, k = K;
    for(int i = 0; i < n; i++) {
        rs[i] = 0;
    }
    for(int i = 0; i < k; i++) {
        marc[P[i]] = 1;
    }
    int pot = 63;
    for(int i = 0; i < n - 1; i++) {
        if(pot < 0) break;
        if(marc[i] = 0 && marc[i + 1] == 0) {
            rs[i] = 1;
            if((1LL << pot) & X) rs[i + 1] = 1;
            else rs[i + 1] = 0;
            i++;
            pot--;
        }
    }
    for( int i = 0; i < N; i++ ){
        Set( i, rs[i] );
    }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
  int  pot = 63;
  long long resp = 0;
  for(int i = 0; i < n; i++) {
    if(A[i] == 1) {
        resp += ((long long) A[i + 1] << pot);
    }
  }

  return resp;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:15:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   15 |         if(marc[i] = 0 && marc[i + 1] == 0) {
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:6:22: error: 'n' was not declared in this scope
    6 |   for(int i = 0; i < n; i++) {
      |                      ^