| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 672236 | Hanksburger | Remittance (JOI19_remittance) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long a[1000005], b[1000005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, l=0, r=2e9;
cin >> n;
for (long long i=1; i<=n; i++)
cin >> a[i] >> b[i];
while (l<r)
{
long long m=(l+r)/2;
for (long long i=n; i>=1; i--)
{
m=m*2-a[i]+b[i];
if (m<0 || m>2e9)
break;
}
if (m<(l+r)/2)
l=(l+r)/2+1;
else
r=(l+r)/2;
}
for (long long i=n; i>=1; i--)
{
l=l*2-a[i]+b[i];
if (l<0 || l>2e9)
break;
}
bool ok=0;
if (l==r)
{
for (long long i=1; i<=n; i++)
{
if (b[i])
{
ok=1;
break;
}
}
}
cout << (ok?"Yes":"No");
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
