# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
310923 |
2020-10-08T14:22:28 Z |
Benmath |
Garage (IOI09_garage) |
C++14 |
|
4 ms |
512 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
long long int a[n];
long long int b[m];
int d[n];
int vis[n];
for(int i=0;i<n;i++){
cin>>a[i];
d[i]=-1;
vis[i]=0;
}
for(int i=0;i<m;i++){
cin>>b[i];
}
long long int sum=0;
for(int i=0;i<2*m;i++){
int x;
cin>>x;
if(x>0){
for(int j=0;j<n;j++){
if(vis[j]==0){
sum=sum+a[j]*b[x-1];
vis[j]++;
d[x-1]=j;
break;
}
}
}else{
x=abs(x);
vis[d[x-1]]--;
d[x-1]=-1;
}
}
cout<<sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
12 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
14 |
Runtime error |
2 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
16 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
4 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |