#include "garage.h"
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, m; cin >> n >> m;
int rates[n]; for(int i = 0; i < n; i++) cin >> rates[i];
int weights[m]; for(int i = 0; i < m; i++) cin >> weights[i];
vector<bool> status(n, true);
vector<int> in(n, -1);
int empty = 0, ans = 0;
for(int i = 0; i < 2 * m; i++){
int x; cin >> x;
if(x > 0){
ans += rates[empty] * weights[x - 1]; status[empty] = false; in[x - 1] = empty;
for(int i = 0; i < n; i++){
if(status[i]) {empty = i; break;}
}
}else{
status[in[abs(x) - 1]] = true; empty = min(empty, in[abs(x - 1)]);
}
}
cout << ans << '\n';
}
Compilation message
garage.cpp:1:10: fatal error: garage.h: No such file or directory
1 | #include "garage.h"
| ^~~~~~~~~~
compilation terminated.