Submission #319380

# Submission time Handle Problem Language Result Execution time Memory
319380 2020-11-05T04:52:08 Z Dan4Life Garage (IOI09_garage) C++17
0 / 100
11 ms 492 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
    int n, m;
    cin >> n >> m;
    vector<int> v(n+5, 0);
    int a[1000];
    for(int i = 0; i < n; i++) cin >> a[i];
    map<int,int> M;
    for(int i = 0; i < m; i++) cin >> M[i+1];
    queue<int> Q;
    int cnt = 0, ans = 0;
    for(int i = 0; i < 2*m; i++)
    {
        int x; cin >> x;
        if(x>0)
        {
            if(cnt==n) Q.push(x);
            else{
                cnt++;
                for(int j = 0; j < n; j++)
                {
                    if(v[j]!=0) continue;
                    v[j]=x, ans+=a[j]*M[x];
                    cout << a[j]*M[x] << "\n";
                    break;
                }
            }
        }
        else{
            x*=-1;
            for(int j = 0; j < n; j++)
            {
                if(v[j]!=x) continue;
                v[j]=0, cnt--;
                if(!Q.empty()){
                    int z = Q.front(); Q.pop();
                    v[j]=z, ans+=a[j]*M[z], cnt++;
                    cout << a[j]*M[x] << "\n";
                }
            }
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Incorrect 1 ms 364 KB Output isn't correct
11 Incorrect 2 ms 360 KB Output isn't correct
12 Incorrect 2 ms 364 KB Output isn't correct
13 Incorrect 2 ms 364 KB Output isn't correct
14 Incorrect 3 ms 364 KB Output isn't correct
15 Incorrect 4 ms 364 KB Output isn't correct
16 Incorrect 5 ms 364 KB Output isn't correct
17 Incorrect 6 ms 364 KB Output isn't correct
18 Incorrect 8 ms 492 KB Output isn't correct
19 Incorrect 8 ms 492 KB Output isn't correct
20 Incorrect 11 ms 492 KB Output isn't correct