답안 #939935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939935 2024-03-07T01:40:49 Z ezzzay Art Exhibition (JOI18_art) C++14
10 / 100
4 ms 2648 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5e5+5;
int a[N],b[N];
signed main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    for(int i=1;i<(1<<n);i++){
        int x=LLONG_MAX;
        int y=LLONG_MIN;
        int s=0;
        for(int j=0;j<n;j++){
            if(i & (1<<j)){
                x=min(x,a[j]);
                y=max(y,a[j]);
                s+=b[j];
            }
        }
        ans=max(ans,s-(y-x));
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 4 ms 2496 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 4 ms 2496 KB Output is correct
5 Correct 4 ms 2392 KB Output is correct
6 Correct 4 ms 2396 KB Output is correct
7 Correct 4 ms 2396 KB Output is correct
8 Correct 4 ms 2396 KB Output is correct
9 Correct 4 ms 2396 KB Output is correct
10 Correct 4 ms 2396 KB Output is correct
11 Correct 4 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 4 ms 2496 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 4 ms 2496 KB Output is correct
5 Correct 4 ms 2392 KB Output is correct
6 Correct 4 ms 2396 KB Output is correct
7 Correct 4 ms 2396 KB Output is correct
8 Correct 4 ms 2396 KB Output is correct
9 Correct 4 ms 2396 KB Output is correct
10 Correct 4 ms 2396 KB Output is correct
11 Correct 4 ms 2648 KB Output is correct
12 Incorrect 3 ms 2396 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 4 ms 2496 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 4 ms 2496 KB Output is correct
5 Correct 4 ms 2392 KB Output is correct
6 Correct 4 ms 2396 KB Output is correct
7 Correct 4 ms 2396 KB Output is correct
8 Correct 4 ms 2396 KB Output is correct
9 Correct 4 ms 2396 KB Output is correct
10 Correct 4 ms 2396 KB Output is correct
11 Correct 4 ms 2648 KB Output is correct
12 Incorrect 3 ms 2396 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 4 ms 2496 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 4 ms 2496 KB Output is correct
5 Correct 4 ms 2392 KB Output is correct
6 Correct 4 ms 2396 KB Output is correct
7 Correct 4 ms 2396 KB Output is correct
8 Correct 4 ms 2396 KB Output is correct
9 Correct 4 ms 2396 KB Output is correct
10 Correct 4 ms 2396 KB Output is correct
11 Correct 4 ms 2648 KB Output is correct
12 Incorrect 3 ms 2396 KB Output isn't correct
13 Halted 0 ms 0 KB -