답안 #231509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231509 2020-05-13T21:04:45 Z cstuart Broken Device (JOI17_broken_device) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "Annalib.h"
 
void Anna (int N, long long X, int K, int P[]) {
  
  bool     fuc[N+5], init;
  int      pre[N+5], b;
  string   rep[3] = {"0011", "0101", "1001"};
  
  memset(func, 1, sizeof func);
  for (int i = 0; i < K; i++) fuc[P[i]] = 0;
  
  for (int s = 0; s < 3; s++) {
    init = 0;
    b = 0;
    for (int i = 0; i < N; i++) {
      if (!fuc[i]) pre[i] = 0;
      else if (!init && i % 3 == s) pre[i] = 1, init = 1;
      else if (!init) pre[i] = 0;
      else if (b == 60) pre[i] = 0;
      else if (((1ll << b) & X) == 0 && rep[s][i % (int)rep.length()] == '1') pre[i] = 0;
      else if (((1ll << b) & X) > 0  && rep[s][i % (int)rep.length()] == '0') pre[i] = 0;
      else pre[i] = 1, b++;
    }
    if (b == 60) {
      for (int i = 0; i < N; i++) Set(i, pre[i]);
      return;
    }
  }

  assert(false);
}
#include <bits/stdc++.h>
using namespace std;
#include "Brunolib.h"
 
long long Bruno (int N, int A[]) {
  
  string     rep[3] = {"0011", "0101", "1001"};
  long long  V = 0;
  int        s = -1;
  int        b = 0;
  
  for (int i = 0; i < N; i++) {
    if (A[i] == 1) {
      if (!init) s = i % 3;
      else if (rep[s][i % (int)rep.length()] == '1') V += (1ll << b), b++;
      else b++;
    }
  }
  
  return V;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:11:10: error: 'func' was not declared in this scope
   memset(func, 1, sizeof func);
          ^~~~
Anna.cpp:11:10: note: suggested alternative: 'fuc'
   memset(func, 1, sizeof func);
          ^~~~
          fuc
Anna.cpp:22:61: error: request for member 'length' in 'rep', which is of non-class type 'std::__cxx11::string [3] {aka std::__cxx11::basic_string<char> [3]}'
       else if (((1ll << b) & X) == 0 && rep[s][i % (int)rep.length()] == '1') pre[i] = 0;
                                                             ^~~~~~
Anna.cpp:23:61: error: request for member 'length' in 'rep', which is of non-class type 'std::__cxx11::string [3] {aka std::__cxx11::basic_string<char> [3]}'
       else if (((1ll << b) & X) > 0  && rep[s][i % (int)rep.length()] == '0') pre[i] = 0;
                                                             ^~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:14:12: error: 'init' was not declared in this scope
       if (!init) s = i % 3;
            ^~~~
Bruno.cpp:14:12: note: suggested alternative: 'int'
       if (!init) s = i % 3;
            ^~~~
            int
Bruno.cpp:15:36: error: request for member 'length' in 'rep', which is of non-class type 'std::__cxx11::string [3] {aka std::__cxx11::basic_string<char> [3]}'
       else if (rep[s][i % (int)rep.length()] == '1') V += (1ll << b), b++;
                                    ^~~~~~