제출 #409897

#제출 시각아이디문제언어결과실행 시간메모리
409897Dan4Life쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
#define ll long long
int besthub(int n, int m, int a[], ll k)
{
    ll ans = 0;
    for(int i = 0; i < n; i++){
        multiset<int> S; S.clear();
        for(int j = 0; j < n; j++)
            S.insert(abs(a[i]-a[j]));
        ll K = k, cnt = 0;
        while(!S.empty() and K>=(*S.begin()))
            cnt++, K-=(*S.begin()), S.erase(S.begin());
        if(ans<cnt)ans=cnt;
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:6:9: error: 'multiset' was not declared in this scope
    6 |         multiset<int> S; S.clear();
      |         ^~~~~~~~
ricehub.cpp:6:18: error: expected primary-expression before 'int'
    6 |         multiset<int> S; S.clear();
      |                  ^~~
ricehub.cpp:6:26: error: 'S' was not declared in this scope
    6 |         multiset<int> S; S.clear();
      |                          ^
ricehub.cpp:8:22: error: 'abs' was not declared in this scope; did you mean 'ans'?
    8 |             S.insert(abs(a[i]-a[j]));
      |                      ^~~
      |                      ans