| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 204488 | T0p_ | Art Exhibition (JOI18_art) | C++14 | 15 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long a[20], b[20];
int main()
{
int n;
long long ans = -1e15;
scanf(" %d",&n);
if(n > 16) return 0;
for(int i=1 ; i<=n ; i++)
scanf(" %lld %lld",&a[i], &b[i]);
for(int i=1 ; i<(1<<n) ; i++)
{
int temp = i;
long long s = 0, am = 1e15, aM = -1e15;
for(int j=1 ; j<=n ; j++)
{
if(temp%2)
{
s += b[j];
am = min(am, a[j]);
aM = max(aM, a[j]);
}
temp /= 2;
}
ans = max(ans, s - (aM - am));
}
printf("%lld\n",ans);
return 0;
}
Compilation message (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... | ||||
