답안 #100031

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100031 2019-03-09T06:52:20 Z oolimry Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include "Annalib.h"
void Anna( int N, long long X, int K, int P[] ){
    set<int> bad;
    for(int i = 0;i < K;i++){
        bad.insert(P[i]);
    }
    int bin[60];
    for(int i = 0;i < 60;i++){
        long long f = 1ll << i;

        if(f&X){
            bin[i] = 1;
        }
        else{
            bin[i] = 0;
        }
    }
    int c = 0;
  for( int i = 0; i < N; i++ ){
    if(bad.find(i) != bad.end()) Set(i,0);
    else if(bad.find(i+1) != bad.end()) Set(i,0);
    else{
        if(c == 60){
            Set(i,0);
        }
        Set(i,1);
        Set(i+1,bin[c]);
        c++;
        i++;
    }
  }
}
#include "Brunolib.h"
long long Bruno( int N, int A[] ){
  long long ans = 0ll;
  int bin[60];
  int c = 0;
  for(int i = 0;i < N;i++){
    if(A[i] == 0) continue;
    else{
        bin[c] = A[i+1];
        c++;
        i++;
    }
  }

  for(int i = 59;i >= 0;i--){
    ans *= 2ll;
    ans += (long long) bin[i];
  }
//cout << ans;
  return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:3:5: error: 'set' was not declared in this scope
     set<int> bad;
     ^~~
Anna.cpp:3:5: note: suggested alternative: 'Set'
     set<int> bad;
     ^~~
     Set
Anna.cpp:3:9: error: expected primary-expression before 'int'
     set<int> bad;
         ^~~
Anna.cpp:5:9: error: 'bad' was not declared in this scope
         bad.insert(P[i]);
         ^~~
Anna.cpp:20:8: error: 'bad' was not declared in this scope
     if(bad.find(i) != bad.end()) Set(i,0);
        ^~~