Submission #582342

#TimeUsernameProblemLanguageResultExecution timeMemory
582342wdjpngHoliday (IOI14_holiday)C++17
0 / 100
11 ms1492 KiB
#include"holiday.h" #include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < ((int) n); i++) #define all(a) a.begin(), a.end() using namespace std; int findMaxAttraction(signed n, signed start, signed d, signed attraction[]) { vector<int>x(n); rep(i,n) x[i] = attraction[i]; if(n<=20) { int maxx=0; rep(i,n) { for(int j = i; j < n; j++) { priority_queue<int>pq; for(int k = i; k <= j; k++) { pq.push(x[k]); } int sum = 0; rep(i,(d-abs(start-i)-abs(i-j))/2) if(pq.size()){sum+=pq.top(); pq.pop();} maxx=max(sum,maxx); } } return maxx; } }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:11:19: warning: control reaches end of non-void function [-Wreturn-type]
   11 |     vector<int>x(n);
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...