답안 #1049755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049755 2024-08-09T04:45:39 Z vjudge1 Art Exhibition (JOI18_art) C++17
10 / 100
3 ms 456 KB
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#include <bits/stdc++.h>
#define ll long long int
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define TxtIO freopen("lol.in","r",stdin); freopen("lol.txt","w",stdout);
#define forn(i,n) for(int i=0;i<n;i++)
#define pb push_back
using namespace std;

void solve(){
    ll n;
    cin>>n;
    vector <pair<ll,ll>> v(n);
    forn(i,n) cin>>v[i].first>>v[i].second;
    ll ans=0;
    for(int i=1;i<(1<<n);i++){
        ll sum=0,max1=0,min1=1e18;
        for(int j=0;j<n;j++){
            if((i>>j)&1){
                sum+=v[j].second;
                max1=max(max1,v[j].first);
                min1=min(min1,v[j].first);
            }
        }
        ans=max(ans,sum-(max1-min1));
    }
    cout<<ans;
}

signed main(){
    speed;
    int t=1;
    while(t--){
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 452 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 456 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 3 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 452 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 456 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 3 ms 452 KB Output is correct
12 Incorrect 2 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 452 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 456 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 3 ms 452 KB Output is correct
12 Incorrect 2 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 452 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 456 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 3 ms 452 KB Output is correct
12 Incorrect 2 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -