제출 #1072682

#제출 시각아이디문제언어결과실행 시간메모리
1072682ProtonDecay314휴가 (IOI14_holiday)C++17
23 / 100
10 ms2836 KiB
#include"holiday.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<vpi> vvpi; typedef vector<vpll> vvpll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef short int si; typedef vector<si> vsi; typedef vector<vsi> vvsi; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define INF(type) numeric_limits<type>::max() #define NINF(type) numeric_limits<type>::min() #define TCASES int t; cin >> t; while(t--) ll findMaxAttraction(int n, int start, int d, int attraction[]) { ll cur_sum = 0ll; ll ans = 0ll; priority_queue<ll, vector<ll>, greater<ll>> q; L(i, 0ll, n) { // Expand the interval // Compute the new max number to pick ll count_pick = d - i; ll curv = attraction[i]; if(count_pick == 0ll) break; if(q.size() < count_pick) { q.push(curv); cur_sum += curv; } else { // Remove elements as needed ll top_elem = q.top(); if(q.size() > count_pick) { cur_sum -= top_elem; q.pop(); } // Replace elements as needed top_elem = q.top(); if(top_elem < curv) { cur_sum -= top_elem; q.pop(); cur_sum += curv; q.push(curv); } } ans = max(ans, cur_sum); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

holiday.cpp: In function 'll findMaxAttraction(int, int, int, int*)':
holiday.cpp:49:21: 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]
   49 |         if(q.size() < count_pick) {
      |            ~~~~~~~~~^~~~~~~~~~~~
holiday.cpp:55:25: 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]
   55 |             if(q.size() > count_pick) {
      |                ~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...