Submission #204488

# Submission time Handle Problem Language Result Execution time Memory
204488 2020-02-26T04:07:23 Z T0p_ Art Exhibition (JOI18_art) C++14
10 / 100
15 ms 376 KB
#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

art.cpp: In function 'int main()':
art.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d",&n);
  ~~~~~^~~~~~~~~~
art.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %lld %lld",&a[i], &b[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
5 Correct 9 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
5 Correct 9 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 10 ms 376 KB Output is correct
12 Incorrect 5 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
5 Correct 9 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 10 ms 376 KB Output is correct
12 Incorrect 5 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
5 Correct 9 ms 256 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 10 ms 376 KB Output is correct
12 Incorrect 5 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -