Submission #1071833

# Submission time Handle Problem Language Result Execution time Memory
1071833 2024-08-23T11:42:08 Z edogawa_something Tricks of the Trade (CEOI23_trade) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
const ll M=6e3+10;
ll n,k,a[M],b[M];
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    ll ans=0;
    for(int i=0;i<n;i++) {
        ll nsum=0,psum=0;
        priority_queue<ll,vii,greater<ll>>q;
        for(int j=i;j<n;j++) {
            nsum+=a[i];
            if(q.size()<k)
                q.push(b[i]),psum+=b[i];
            else {
                if(b[i]<q.top())
                    continue;
                else
                    psum-=q.top(),q.pop(),q.push(b[i]),psum+=b[i];
            }
            ans=max(ans,psum-nsum);
        }
    }
    cout<<ans<<'\n';
    return 0;
}

Compilation message

trade.cpp: In function 'int main()':
trade.cpp:25:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   25 |             if(q.size()<k)
      |                ~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -