제출 #701907

#제출 시각아이디문제언어결과실행 시간메모리
701907PCTprobability휴가 (IOI14_holiday)C++17
7 / 100
10 ms1236 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; using ll = long long; ll findMaxAttraction(int n,int start,int d,int attraction[]){ ll ans=0; assert(n<=20); for(int i=start;i>=0;i--){ for(int j=start;j<n;j++){ int ca=d-(start-i)-(j-start)-min(start-i,j-start); if(ca<0) continue; vector<int> a; for(int l=i;l<=j;l++) a.push_back(attraction[l]); sort(a.begin(),a.end()); reverse(a.begin(),a.end()); ll now=0; for(int l=0;l<ca&&l<a.size();l++) now+=a[l]; ans=max(ans,now); } } return ans; }

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

holiday.cpp: In function 'll findMaxAttraction(int, int, int, int*)':
holiday.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |       for(int l=0;l<ca&&l<a.size();l++) now+=a[l];
      |                         ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...