| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 935171 | Rux007 | Self Study (JOI22_ho_t2) | C++14 | 197 ms | 29668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <queue>
using namespace std;
const int nmax = 300005;
unsigned long long n, m, a[nmax], b[nmax], v[nmax];
priority_queue< pair<unsigned long long, unsigned long long> > H, H2;
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i ++)
cin >> a[i];
for(int i = 1; i <= n; i ++)
{
cin >> b[i];
v[i] = max(a[i], b[i]);
}
for(int i = 1; i <= n; i ++)
{
H.push({v[i] * m, i});
H2.push({-v[i] * m , i});
}
int ok = 1;
while(ok)
{
unsigned long long maxi = H.top().first;
unsigned long long pozmax = H.top().second;
unsigned long long mini = -H2.top().first;
unsigned long long pozmin = H2.top().second;
if(maxi - v[pozmax] <= mini)
{
ok = 0;
continue;
}
maxi -= v[pozmax];
if(v[pozmin] == a[pozmin])
mini += b[pozmin];
else
mini += a[pozmin];
H.pop(); H2.pop();
H.push({maxi, pozmax});
H2.push({-mini, pozmin});
}
cout << -H2.top().first;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
