Submission #424428

# Submission time Handle Problem Language Result Execution time Memory
424428 2021-06-11T23:12:55 Z APROHACK Holiday (IOI14_holiday) C++14
0 / 100
5000 ms 3028 KB
#include"holiday.h"
#include <bits/stdc++.h>
#define PB push_back
#define F first
#define S second
using namespace std;
//int att[100000];
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
    ////for(int i = 0 ; i < n ; i++)att[i]=attraction[i];
    
    long long rta = 0;
    for(int left = start ; left>= 0 ; left++){
        long long cur = 0;
        priority_queue<long long>pq;
        for(int i = left ; i < start ; i++){
            pq.push(-attraction[i]);
            cur+=attraction[i];
        }
        for(int r = start ; r< n ; r++){
            cur+=attraction[r];
            pq.push(-attraction[r]);
            int dist = r - left + min(start - left, r - start);
            if(d - dist <= 0) break;
            while(pq.size() > d - dist){
				cur -= pq.top();
				pq.pop();
			}
            rta = max(cur, rta);
        }
    }
    return rta;
}

Compilation message

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:24:29: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |             while(pq.size() > d - dist){
      |                   ~~~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 5067 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5044 ms 3028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5058 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5019 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -