#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
228 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
14 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
15 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
19 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
20 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 11 |