Submission #1112060

# Submission time Handle Problem Language Result Execution time Memory
1112060 2024-11-13T15:24:17 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 336 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(unsigned 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=0;
    for(int i=0;i<N;i++) {
        cin >> temp;
        SizeA.push_back(temp);
        cin >> temp;
        PriceB.push_back(temp);
    }
    for(unsigned int i=0;i<SizeA.size()-1;i++){
        for(unsigned int j=i+1;j<SizeA.size();j++){
            if(i==j) continue;
            //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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -