답안 #1112040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112040 2024-11-13T14:43:31 Z vjudge1 Art Exhibition (JOI18_art) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int N;
vector<long long int> SizeA={};
vector<long long int> PriceB={};
long long int findS(long long int Amin,long long int Amax){
    long long int sum=0;
    for(__SIZE_TYPE__ i=0;i<SizeA.size();i++){
        if(SizeA.at(i)>=Amin && SizeA.at(i)<=Amax) {
            sum+=PriceB.at(i);
        }
    }
    return sum;
}
int main() {
    cin >> N;
    long long int temp,Max=LLONG_MIN;
    for(int i=0;i<N;i++) {
        cin >> temp;
        SizeA.push_back(temp);
        cin >> temp;
        PriceB.push_back(temp);
    }
    for(__SIZE_TYPE__ i=0;i<SizeA.size()-1;i++){
        for(__SIZE_TYPE__ j=i+1;j<SizeA.size();j++){
            //cout << i << " " << j << " S is " << findS(min(SizeA.at(i),SizeA.at(j)),max(SizeA.at(i),SizeA.at(j)))<< endl;
            temp=findS(min(SizeA.at(i),SizeA.at(j)),max(SizeA.at(i),SizeA.at(j)))-abs(SizeA.at(i)-SizeA.at(j));
            if(Max<temp){
                Max=temp;
                //cout << "New max found "<<Max<<" i is "<<i<<" pointing to "<<SizeA.at(i)<<" j is "<<j<<" pointing to "<<SizeA.at(j)<<" and S is "<<temp<< endl;
            }
        }
    }
    cout << Max;
    return 0;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:19:28: error: 'LLONG_MIN' was not declared in this scope
   19 |     long long int temp,Max=LLONG_MIN;
      |                            ^~~~~~~~~
art.cpp:3:1: note: 'LLONG_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | #include <vector>