# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
310926 | 2020-10-08T14:45:08 Z | Benmath | Garage (IOI09_garage) | C++14 | 4 ms | 384 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]; vis[i]=0; } for(int i=0;i<m;i++){ cin>>b[i]; d[i]=-1; } long long int sum=0; queue<int>q; for(int i=0;i<2*m;i++){ int x; cin>>x; if(x>0){ int brojac=0; q.push(x); }else{ x=abs(x);vis[d[x-1]]--; d[x-1]=-1; } if(!q.empty()){ int l=q.front(); q.pop(); for(int j=0;j<n;j++){ if(vis[j]==0){ sum=sum+a[j]*b[l-1]; vis[j]++; d[l-1]=j; break; } } } } cout<<sum; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Incorrect | 0 ms | 256 KB | Output isn't correct |
5 | Incorrect | 0 ms | 256 KB | Output isn't correct |
6 | Incorrect | 1 ms | 256 KB | Output isn't correct |
7 | Incorrect | 0 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 | Incorrect | 1 ms | 256 KB | Output isn't correct |
13 | Incorrect | 1 ms | 256 KB | Output isn't correct |
14 | Incorrect | 2 ms | 256 KB | Output isn't correct |
15 | Incorrect | 2 ms | 256 KB | Output isn't correct |
16 | Incorrect | 2 ms | 256 KB | Output isn't correct |
17 | Incorrect | 3 ms | 256 KB | Output isn't correct |
18 | Incorrect | 3 ms | 384 KB | Output isn't correct |
19 | Incorrect | 4 ms | 256 KB | Output isn't correct |
20 | Incorrect | 3 ms | 384 KB | Output isn't correct |