Submission #582362

#TimeUsernameProblemLanguageResultExecution timeMemory
582362wdjpngHoliday (IOI14_holiday)C++17
7 / 100
12 ms1452 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(b,(d-min(abs(start-i),abs(j-start))-abs(i-j))) 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...