-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1106B.cpp
56 lines (44 loc) · 875 Bytes
/
1106B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<bits/stdc++.h>
using namespace std;
int main()
{
int dis[100],cost[100],n,m;
cin >> n >> m;
for(int i=0; i<n; i++)
cin >> dis[i];
for(int i=0; i<n; i++)
{
cin >> a[i];
cost[i]=a[i];
}
sort(a,a+n);
int mincost = a[0];
int j = 0;
for(int i=0; i<n; i++)
{
if(mincost==cost[i])
{
min_cost_dis[j] = cost[i];
j++;
}
}
for(int i=0; i<m; i++)
{
cin >> t >> d;
if(dis[t] < d)
{
}
else
{
sum = sum + dis[t] * cost[t];
dis[t] = dis[t] - dis[t];
d= d-dis[t];
if(d==0)
break;
else
{
sum = sum +
}
}
}
}