QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#484670#8768. Arrested DevelopmentLos_Medonhos#WA 0ms3588kbC++171.4kb2024-07-19 21:02:512024-07-19 21:02:52

Judging History

你现在查看的是最新测评结果

  • [2024-07-19 21:02:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-07-19 21:02:51]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int mxn = 1e5+5;
const long long INF = 0x3f3f3f3f;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(nullptr);

    int n;
    cin >> n;
    
    vector<pair<int, int> > v(n);

    for(int i=0; i<n; i++){
        cin >> v[i].first >> v[i].second;
    }

    int mid = (n+2)/3;

    int resp1 = INF, resp2 = INF, resp3 = INF;

    for(int i=0; i<(1<<mid); i++){
        int sum = 0, sum2 = 0;
        for(int j=0; j<mid; j++){
            if(i & (1<<j)) sum += v[j].first;
            else sum2+=v[j].second;
        }
        //cout << sum << ' ' << sum2 << endl;
        resp1 = min(resp1, max(sum, sum2));
    }
    for(int i=0; i<(1<<(min(2*mid, n) - mid)); i++){
        int sum = 0, sum2 = 0;
        for(int j=mid; j<min(2*mid, n); j++){
            if(i & (1<<(j-mid))) sum += v[j].first;
            else sum2+=v[j].second;
        }
        //cout << sum << ' ' << sum2 << endl;
        resp2 = min(resp2, max(sum, sum2));
    }

    for(int i=0; i<(1<<(n - 2*mid)); i++){
        int sum = 0, sum2 = 0;
        for(int j=2*mid; j<n; j++){
            if(i & (1<<(j-2*mid))) sum += v[j].first;
            else sum2+=v[j].second;
        }
        //cout << sum << ' ' << sum2 << endl;
        resp3 = min(resp3, max(sum, sum2));
    }
    
    cout << resp1+resp2+resp3 << endl;

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3552kb

input:

4
100 1
1 90
1 20
1 20

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

2
314 1
592 6

output:

7

result:

ok single line: '7'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3588kb

input:

1
1 1

output:

1061109568

result:

wrong answer 1st lines differ - expected: '1', found: '1061109568'