# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
50493 | mirbek01 | 휴가 (IOI14_holiday) | C++17 | 88 ms | 1104 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"holiday.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
int n, cnt[N];
long long int findMaxAttraction(int N, int start, int d, int attraction[]) {
n = N;
int fl = 1;
long long ans = 0;
for(int i = 0; i < n; i ++)
if(attraction[i] > 100) fl = 0;
if(!start && fl){
for(int i = 0; i < n; i ++){
cnt[attraction[i]] ++;
long long res = 0;
if(i < d){
int now = d - i;
for(int i = 100; i >= 0; i --){
if(now >= cnt[i]){
res += cnt[i] * i;
now -= cnt[i];
} else {
res += now * i;
now = 0;
}
}
}
ans = max(ans, res);
}
} else {
if(n <= 20){
for(int mask = 1; mask < (1 << n); mask ++){
int kol = 0;
long long res = 0, l, r;
for(int i = 0; i < n; i ++){
int bit = (1 << i) & mask;
if(bit){
res += attraction[i];
if(l == -1) l = i;
r = i;
kol ++;
}
}
kol += min( max(0ll, start - l) * 2 + max(0ll, r - start), max(0ll, start - l) + max(0ll, r - start) * 2 );
if(kol <= d) ans = max(ans, res);
}
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |