QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#437547#8768. Arrested Developmentucup-team045#WA 0ms3816kbC++20920b2024-06-09 13:18:392024-06-09 13:18:39

Judging History

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

  • [2024-06-09 13:18:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-06-09 13:18:39]
  • 提交

answer

#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
using LL = long long;

int main(){

#ifdef LOCAL
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif

    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);

    int n;
    cin >> n;
    vector<pair<int, int> > p(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin() + 1, p.end(), [&](pair<int, int> a, pair<int, int> b){
        return a.first - a.second < b.first - b.second;
    });
    int ans = 1e9;
    for(int i = 0; i <= n; i++){
        int t1 = 0, t2 = 0;
        for(int j = 1; j <= i; j++){
            t1 += p[j].first;
        }
        for(int j = i + 1; j <= n; j++){
            t2 += p[j].second;
        }
        ans = min(ans, max(t1, t2));
    }
    cout << ans << '\n';

}

詳細信息

Test #1:

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

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: 3556kb

input:

2
314 1
592 6

output:

7

result:

ok single line: '7'

Test #3:

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

input:

1
1 1

output:

1

result:

ok single line: '1'

Test #4:

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

input:

1
100000 1

output:

1

result:

ok single line: '1'

Test #5:

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

input:

1
1 100000

output:

1

result:

ok single line: '1'

Test #6:

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

input:

1
100000 100000

output:

100000

result:

ok single line: '100000'

Test #7:

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

input:

50
78681 95291
22639 1538
12119 52253
50430 63757
66133 92826
61048 40069
33506 30382
96049 50134
42895 62735
86943 16955
9667 61843
49647 9320
29082 16909
69601 68436
19892 34306
29822 79462
73262 14568
1693 35040
89757 61888
56993 48750
89611 77773
54159 21067
32520 41091
52501 92770
36530 17589
5...

output:

885186

result:

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