답안 #927829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927829 2024-02-15T11:17:25 Z takeonicky Art Exhibition (JOI18_art) C++14
10 / 100
7 ms 436 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	long long a[n], b[n];
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i];
	}
	long long ans = 0;
	for(int bit=1; bit<int(pow(2, n)); bit++){
		long long mx = -1;
		long long mn = 1e15 + 1;
		long long sum = 0;
		for(int j=0; j<n; j++){
			if((bit & (1 << j)) > 0){
				sum += b[j];
				mx = max(mx, a[j]);
				mn = min(mn, a[j]);
			}
		}
		ans = max(ans, sum-(mx-mn));
	}
	cout<<ans<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 436 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 7 ms 436 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 428 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 5 ms 436 KB Output is correct
11 Correct 5 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 436 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 7 ms 436 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 428 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 5 ms 436 KB Output is correct
11 Correct 5 ms 436 KB Output is correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 436 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 7 ms 436 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 428 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 5 ms 436 KB Output is correct
11 Correct 5 ms 436 KB Output is correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 436 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 7 ms 436 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 428 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 5 ms 436 KB Output is correct
11 Correct 5 ms 436 KB Output is correct
12 Incorrect 1 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -