Submission #717730

#TimeUsernameProblemLanguageResultExecution timeMemory
717730Vlatko09Garage (IOI09_garage)C++14
5 / 100
2 ms440 KiB
#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 timeMemoryGrader output
Fetching results...