# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717730 | Vlatko09 | Garage (IOI09_garage) | C++14 | 2 ms | 440 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,g=0,l;
cin>>n>>m;
int a[n],b[m],c[n]={0};
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<m;i++)
cin>>b[i];
for(int i=0;i<m;i++)
{
cin>>l;
g+=a[i]*b[l-1];
if(g<0)
{
for(int j=0;j<n;j++)
if(c[i]==abs(l))
c[i]=0;
}
else if(g>0)
{
c[i]=l;
}
}
cout<<g;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |