# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
966194 | AkibAzmain | 사탕 분배 (IOI21_candies) | C++17 | 146 ms | 24640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<int> distribute_candies (std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v)
{
ll n = c.size();
v.push_back (0);
vector < ll > a;
for (auto &x : v) a.push_back (x);
reverse (a.begin (), a.end ());
a.push_back (-1e18);
for (auto &x : a) x *= -1;
for (int i = 1; i < a.size (); ++i) a[i] += a[i - 1];
ll mn = 0, mx = 0;
vector < ll > mna (a.size ()), mxa = mna;
map < ll, int > mp;
for (int i = 0; i < a.size (); ++i)
{
mna[i] = mn = min (mn, a[i]);
mxa[i] = mx = max (mx, a[i]);
if (mp.count (mx - mn) == 0) mp[mx - mn] = i;
}
vector < int > ans (n);
for (int i = 0; i < n; ++i)
{
int j = mp.lower_bound (c[i])->second;
if (a[j] == mna[j])
ans[i] = c[i] - mxa[j];
else
ans[i] = -mna[j];
if (ans[i] < 0) ans[i] += c[i];
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |