Submission #539456

# Submission time Handle Problem Language Result Execution time Memory
539456 2022-03-19T02:14:02 Z MurotY Garage (IOI09_garage) C++14
40 / 100
4 ms 472 KB
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
#define ll long long
using namespace std;
const int N=1e6+7, M=1e9+7;
ll a[N], b[N];
void solve()
{
	ll n, m;
	cin >> n >> m;
	
	for (int i=1;i<=n;i++) cin >> a[i];
	for (int i=1;i<=m;i++) cin >> b[i];
	
	map <ll,ll> mp, mp1;
	ll ans=0;
	for (int i=1;i<=2*m;i++){
		ll x;
		cin >> x;
		if (x > 0){
			for (int i=1;i<=n;i++){
				if (mp[i] == 0) {
					mp[i]=1;
					ans+=a[i]*b[x];
					mp1[x]=i;
					break;
				}
			}
		}
		else mp[mp1[-x]]=0;
	}
	cout << ans;
}
int main()
{
	ios;
	int t=1;
//	cin >> t;
	while (t--){
		solve(); 
		cout << "\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Correct 1 ms 328 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Correct 0 ms 328 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 340 KB Output isn't correct
9 Correct 0 ms 212 KB Output is correct
10 Incorrect 1 ms 328 KB Output isn't correct
11 Correct 1 ms 324 KB Output is correct
12 Incorrect 1 ms 340 KB Output isn't correct
13 Correct 1 ms 336 KB Output is correct
14 Incorrect 1 ms 344 KB Output isn't correct
15 Correct 1 ms 344 KB Output is correct
16 Incorrect 2 ms 384 KB Output isn't correct
17 Incorrect 2 ms 472 KB Output isn't correct
18 Incorrect 2 ms 464 KB Output isn't correct
19 Incorrect 4 ms 468 KB Output isn't correct
20 Incorrect 2 ms 468 KB Output isn't correct