Submission #997120

# Submission time Handle Problem Language Result Execution time Memory
997120 2024-06-11T17:48:28 Z Luca1234 Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

vector <pair <long long, int> > v;

int main()
{
    int n, val;
    long long sz;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>sz>>val;
        v.push_back({sz, val});
    }
    sort(v.begin(), v.end());
    long long ans=-1e15, aux=-1e15, sum=0;
    for(int i=0; i<v.size(); i++)
    {
        aux=max(aux, v[i].first-sum);
        ans=max(ans, sum-v[i].second+aux);
    }

    cout<<ans;

    return 0;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0; i<v.size(); i++)
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -