답안 #1112036

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112036 2024-11-13T14:40:00 Z vjudge1 Art Exhibition (JOI18_art) C++
컴파일 오류
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(int 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(int i=0;i<SizeA.size()-1;i++){
        for(int 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 'long long int findS(long long int, long long int)':
art.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<SizeA.size();i++){
      |                 ~^~~~~~~~~~~~~
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:4:1: note: 'LLONG_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?
    3 | #include <vector>
  +++ |+#include <climits>
    4 | using namespace std;
art.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0;i<SizeA.size()-1;i++){
      |                 ~^~~~~~~~~~~~~~~
art.cpp:27:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=i+1;j<SizeA.size();j++){
      |                       ~^~~~~~~~~~~~~