Submission #1092145

#TimeUsernameProblemLanguageResultExecution timeMemory
1092145huyngoHoliday (IOI14_holiday)C++17
47 / 100
5063 ms2796 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using i64 = long long; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cerr << x; } void __print(double x) { cerr << x; } void __print(long double x) { cerr << x; } void __print(char x) { cerr << '\'' << x << '\''; } void __print(const char* x) { cerr << '"' << x << '"'; } void __print(const string& x) { cerr << '"' << x << '"'; } void __print(bool x) { cerr << (x ? "true" : "false"); } template<typename T, typename V> void __print(const pair<T, V>& x) { cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'; } template<typename T> void __print(const T& x) { int f = 0; cerr << '{'; for (auto& i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"; } void _print() { cerr << "]\n"; } template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); } #define dbg(x...) cerr << "[" << #x << "] = ["; _print(x) #define ln "\n" #define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define all(x) (x).begin(), (x).end() #define rep(i,a,b) for(int i=a; i<=b; ++i) #define ar array int Bit(int mask, int b) { return (mask >> b) & 1; } const ll base = 311, MOD = 998244353, M = 1e9 + 7, INF = 1e18; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { int64_t ans = 0; for (int l = start; l >= 0; --l) { priority_queue<int, vector<int>, greater<int>> pq; int64_t sum = 0; for (int r = l; r < n; ++r) { pq.push(attraction[r]); sum += attraction[r]; if (r < start) continue; int k = d - min(start - l + r - l, r - start + r - l); if (k <= 0) break; while (pq.size() > k) { sum -= pq.top(); pq.pop(); } ans = max(ans, sum); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:29:30: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |             while (pq.size() > k) {
      |                    ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...