답안 #224623

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
224623 2020-04-18T14:03:27 Z AASG 쌀 창고 (IOI11_ricehub) C++11
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B){
    memset(adr,0,sizeof(adr));
    for(long i=0;i<R;i++)adr[X[i]]=1;
    long mx=0;
  for(long i=1;i<=L;i++){
        long au=0;
        long long ab=B;
        deque<long> rm;
   for(long l=0;l<R;l++){
    rm.push_back(abs(i-R[l]));
   }
   sort(rm.begin(),rm.end());
   for(long l=0;l<rm.size();l++){if(ab-rm[l]>=0){au++;ab=ab-rm[l];}else break;}
    mx=max(mx,au);
  }
  R=mx;
  return R;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:12: error: 'adr' was not declared in this scope
     memset(adr,0,sizeof(adr));
            ^~~
ricehub.cpp:13:27: error: invalid types 'int[long int]' for array subscript
     rm.push_back(abs(i-R[l]));
                           ^
ricehub.cpp:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(long l=0;l<rm.size();l++){if(ab-rm[l]>=0){au++;ab=ab-rm[l];}else break;}
                 ~^~~~~~~~~~