답안 #204488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -