# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
342548 |
2021-01-02T11:01:01 Z |
marvenlee |
Garage (IOI09_garage) |
C++14 |
|
12 ms |
504 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef string str;
typedef vector<ll> vl;
typedef vector< vector<ll> > vvl;
typedef vector<ii> vii;
typedef vector< vector<ii> > vvii;
typedef vector<iii> viii;
typedef vector< vector<iii> > vviii;
typedef vector<str> vs;
typedef vector< vector<str> > vvs;
typedef long double ld;
//typelower_bounddef priority_queue<long long> pq;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
#define elif else if
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define FOR(i,v) for(auto i:v)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repn(i,a,b) for(int i=(a);i<=(b);i++)
#define repin(i,a,b,x) for(int i=(a);i<(b);i+=x)
#define repnin(i,a,b,x) for(int i=(a);i<=(b);i+=x)
#define MAX(a,b) a=max(a,b)
#define MIN(a,b) a=min(a,b)
#define fbo find_by_order
#define ook order_of_key
// if else int i = (number <0) ? 1:0 - if (number <0) i=1 else 0
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
int main()
{
int n,m;
cin >> n >> m;
int rate[n];
rep(i,0,n){
cin >> rate[i];
}
set<int> slot;
rep(i,0,n) slot.insert(i);
int weight[m];
rep(i,0,m) cin >> weight[i];
queue<int> waiting;
int st[2001]={0};
ll ans=0;
rep(i,0,2*m){
int ev;
cin >> ev;
if(ev>0){
ev--;
waiting.push(ev);
if(slot.empty()) continue;
ev = waiting.front();
waiting.pop();
int use= *slot.begin();
ans += rate[use]*weight[ev];
slot.erase(slot.begin());
st[ev]=use;
//cout <<"Use" << st[ev] << " ";
}
else {
ev++;
ev*=-1;
//cout << "HI" << st[ev] << " ";
slot.insert(st[ev]);
if(!waiting.empty()){
ev = waiting.front();
waiting.pop();
int use= *slot.begin();
ans += rate[use]*weight[ev];
slot.erase(slot.begin());
st[ev]=use;
}
}
cout << ans << " ";
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
14 |
Incorrect |
5 ms |
364 KB |
Output isn't correct |
15 |
Incorrect |
7 ms |
364 KB |
Output isn't correct |
16 |
Incorrect |
8 ms |
364 KB |
Output isn't correct |
17 |
Incorrect |
8 ms |
364 KB |
Output isn't correct |
18 |
Incorrect |
9 ms |
364 KB |
Output isn't correct |
19 |
Incorrect |
7 ms |
384 KB |
Output isn't correct |
20 |
Incorrect |
12 ms |
504 KB |
Output isn't correct |