제출 #62624

#제출 시각아이디문제언어결과실행 시간메모리
62624mhnd휴가 (IOI14_holiday)C++14
47 / 100
963 ms4276 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 2e5+50; const ll oo = 1e18; const ll mod = 1e9+7; ll f[101],ans; long long int findMaxAttraction(int n, int start, int d, int a[]){ if(n <= 3000){ multiset<int> q; ll sum = 0; for(int i=start;i<n;i++){ ll cur = d-(i-start); if(!cur)break; q.insert(a[i]); sum += a[i]; while(q.size() && q.size() > cur){ sum -= *q.begin(); q.erase(q.begin()); } ans = max(ans,sum); } sum = 0; q.clear(); for(int i=start;i>=0;i--){ ll cur = d-(start-i); if(!cur)break; q.insert(a[i]); sum += a[i]; while(q.size() && q.size() > cur){ sum -= *q.begin(); q.erase(q.begin()); } ans = max(ans,sum); } for(int i=start;i<n;i++){ sum = 0; q.clear(); ll cur = d-(i-start); if(!cur)break; for(int j=i;j>=0;j--){ if(!cur)break; q.insert(a[j]); sum+=a[j]; while(q.size() && q.size() > cur){ sum -= *q.begin(); q.erase(q.begin()); } cur--; ans = max(ans,sum); } } for(int i=start;i>=0;i--){ sum = 0; q.clear(); ll cur = d-(start-i); if(!cur)break; for(int j=i;j<n;j++){ if(!cur)break; q.insert(a[j]); sum+=a[j]; while(q.size() && q.size() > cur){ sum -= *q.begin(); q.erase(q.begin()); } cur--; ans = max(ans,sum); } } return ans; } for(int i=0;i<n;i++){ f[a[i]]++; if(i > d)break; int k = d - i,cur=0; for(int j=100;j>=0&&k;j--){ int v = min(k*1ll,f[j]); k-=v; cur += j*v; } ans = max(ans,cur*1ll); } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:23:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(q.size() && q.size() > cur){
                      ~~~~~~~~~^~~~~
holiday.cpp:36:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(q.size() && q.size() > cur){
                      ~~~~~~~~~^~~~~
holiday.cpp:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(q.size() && q.size() > cur){
                       ~~~~~~~~~^~~~~
holiday.cpp:68:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(q.size() && q.size() > cur){
                       ~~~~~~~~~^~~~~
grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...