185612025-10-26 18:40:12zsombBányász RPG (40 pont)cpp17Wrong answer 32/4064ms1040 KiB
#include <bits/stdc++.h>
using namespace std;



int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> a(n);

    for(auto& i : a)
        cin >> i.first;

    for(auto& i : a)
        cin >> i.second;

    sort(a.begin(), a.end());
    int t = 0;
    int ido = 0;
    for(int i = 0; i< n; i++){
        if(t >= a[i].first)
            ido += a[i].second;
        else if (a[i].second + t < a[i].first)
            ido += a[i].second*2;
        else 
            ido += 2*(a[i].first - t) + a[i].second + t - a[i].first;
        
        t += a[i].second;
        
    }
    cout << ido;
    
}
SubtaskSumTestVerdictTimeMemory
base32/40
1Wrong answer0/01ms328 KiB
2Accepted0/012ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/29ms332 KiB
6Accepted2/220ms408 KiB
7Accepted2/23ms316 KiB
8Accepted2/24ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms316 KiB
15Wrong answer0/237ms800 KiB
16Wrong answer0/248ms820 KiB
17Wrong answer0/239ms840 KiB
18Wrong answer0/264ms1040 KiB