151432025-02-13 19:20:04iSamu7598Bányász RPG (40 pont)cpp11Time limit exceeded 11/40400ms1076 KiB
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main()
{
int n, ossz=0, tp, time=0;
cin>>n;
vector<int> l(n+1);
vector<int> m(n+1);
for(int i=1; i<=n; i++){
   cin>>l[i];
}
for(int i=1; i<=n; i++){
    cin>>m[i];
    ossz=ossz+m[i];
}
for(int tp=0; tp<ossz; tp++){
    bool x=false;
        int maxi=0, si;
    for(int i=1; i<=n; i++){
            if(maxi<l[i]&&m[i]>0){
        maxi=l[i];
        si=i;
            }
if(tp>=l[i]&&m[i]>0){
    m[i]--;
    time+=1;
x=true;

    break;
}
    }
    if(x==false){

        m[si]--;
        time+=2;
    }
}
cout<<time;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/40
1Accepted0/01ms316 KiB
2Time limit exceeded0/0384ms508 KiB
3Accepted2/22ms316 KiB
4Time limit exceeded0/2384ms316 KiB
5Time limit exceeded0/2400ms316 KiB
6Time limit exceeded0/2400ms564 KiB
7Time limit exceeded0/2388ms316 KiB
8Time limit exceeded0/2388ms508 KiB
9Accepted3/31ms316 KiB
10Accepted3/32ms316 KiB
11Accepted3/37ms316 KiB
12Time limit exceeded0/3400ms316 KiB
13Time limit exceeded0/4400ms316 KiB
14Time limit exceeded0/4381ms316 KiB
15Wrong answer0/232ms564 KiB
16Time limit exceeded0/2400ms820 KiB
17Wrong answer0/234ms820 KiB
18Time limit exceeded0/2400ms1076 KiB