Submission #1112057

# Submission time Handle Problem Language Result Execution time Memory
1112057 2024-11-13T15:15:10 Z omsincoconut Art Exhibition (JOI18_art) C++17
30 / 100
1000 ms 760 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();i++){
        for(unsigned int j=i;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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 404 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 404 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 24 ms 336 KB Output is correct
13 Correct 23 ms 336 KB Output is correct
14 Correct 23 ms 440 KB Output is correct
15 Correct 24 ms 508 KB Output is correct
16 Correct 24 ms 336 KB Output is correct
17 Correct 23 ms 336 KB Output is correct
18 Correct 24 ms 464 KB Output is correct
19 Correct 23 ms 340 KB Output is correct
20 Correct 23 ms 336 KB Output is correct
21 Correct 23 ms 336 KB Output is correct
22 Correct 23 ms 464 KB Output is correct
23 Correct 25 ms 336 KB Output is correct
24 Correct 24 ms 336 KB Output is correct
25 Correct 24 ms 504 KB Output is correct
26 Correct 23 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 404 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 24 ms 336 KB Output is correct
13 Correct 23 ms 336 KB Output is correct
14 Correct 23 ms 440 KB Output is correct
15 Correct 24 ms 508 KB Output is correct
16 Correct 24 ms 336 KB Output is correct
17 Correct 23 ms 336 KB Output is correct
18 Correct 24 ms 464 KB Output is correct
19 Correct 23 ms 340 KB Output is correct
20 Correct 23 ms 336 KB Output is correct
21 Correct 23 ms 336 KB Output is correct
22 Correct 23 ms 464 KB Output is correct
23 Correct 25 ms 336 KB Output is correct
24 Correct 24 ms 336 KB Output is correct
25 Correct 24 ms 504 KB Output is correct
26 Correct 23 ms 336 KB Output is correct
27 Execution timed out 1065 ms 760 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 404 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 24 ms 336 KB Output is correct
13 Correct 23 ms 336 KB Output is correct
14 Correct 23 ms 440 KB Output is correct
15 Correct 24 ms 508 KB Output is correct
16 Correct 24 ms 336 KB Output is correct
17 Correct 23 ms 336 KB Output is correct
18 Correct 24 ms 464 KB Output is correct
19 Correct 23 ms 340 KB Output is correct
20 Correct 23 ms 336 KB Output is correct
21 Correct 23 ms 336 KB Output is correct
22 Correct 23 ms 464 KB Output is correct
23 Correct 25 ms 336 KB Output is correct
24 Correct 24 ms 336 KB Output is correct
25 Correct 24 ms 504 KB Output is correct
26 Correct 23 ms 336 KB Output is correct
27 Execution timed out 1065 ms 760 KB Time limit exceeded
28 Halted 0 ms 0 KB -