이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int nax = 1e5 + 5;
int n, maxi, a[nax];
ll b;
// Subtask 3
int solve() {
int ans = 0;
for (int i = 1; i <= n; ++i) {
// select a[i] as the position
priority_queue<int, vector<int>, greater<int>> pq;
for (int j = 1; j <= n; ++j) {
pq.push(abs(a[i] - a[j]));
}
int cnt = 0, curr = 0;
while (!pq.empty() && curr <= b) {
++cnt;
curr += pq.top();
pq.pop();
}
if (curr > b) --cnt;
ans = max(ans, cnt);
}
return ans;
}
int besthub(int R, int L, int X[], long long B) {
n = R;
maxi = L;
for (int i = 0; i < R; ++i) a[i + 1] = X[i];
b = B;
return solve();
}
컴파일 시 표준 에러 (stderr) 메시지
ricehub.cpp:2: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
2 | #pragma GCC optimization("unroll-loops, no-stack-protector")
|| # | 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... |