답안 #462911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
462911 2021-08-11T02:00:44 Z danielsuh Garage (IOI09_garage) C++17
0 / 100
2 ms 512 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N, M; cin >> N >> M;
    assert(0);
    vector<int> prices(N + 1), cars(M + 1);
    for(int i = 1; i <= N; i++) cin >> prices[i];
    for(int i = 1; i <= M; i++) cin >> cars[i];
    set<int> free;
    for(int i = 1; i <= N; i++) {
        free.insert(i);
    }
    deque<int> line;
    map<int, int> spots;
    int ans = 0;
    for(int i = 0; i < 2 * M; i++) {
        int step; cin >> step;
        if(step > 0) {
            if(free.empty()) {
                line.push_back(step);
                continue;
            }
            assert(!free.empty());
            int space = *free.begin();
            free.erase(*free.begin());
            ans += cars[step] * prices[space];
            spots[step] = space;
        }else {
            free.insert(spots[-step]);
            if(!line.empty()) {
                int car = *line.begin();
                ans += cars[car] * prices[spots[-step]];
                line.pop_front();
            }
        }
    }
    assert(line.empty());
    cout << ans << "\n";
}

# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 6
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Runtime error 1 ms 460 KB Execution killed with signal 6
4 Runtime error 1 ms 460 KB Execution killed with signal 6
5 Runtime error 1 ms 460 KB Execution killed with signal 6
6 Runtime error 1 ms 512 KB Execution killed with signal 6
7 Runtime error 1 ms 460 KB Execution killed with signal 6
8 Runtime error 1 ms 460 KB Execution killed with signal 6
9 Runtime error 1 ms 460 KB Execution killed with signal 6
10 Runtime error 2 ms 460 KB Execution killed with signal 6
11 Runtime error 1 ms 460 KB Execution killed with signal 6
12 Runtime error 1 ms 460 KB Execution killed with signal 6
13 Runtime error 1 ms 460 KB Execution killed with signal 6
14 Runtime error 1 ms 460 KB Execution killed with signal 6
15 Runtime error 1 ms 460 KB Execution killed with signal 6
16 Runtime error 1 ms 460 KB Execution killed with signal 6
17 Runtime error 1 ms 460 KB Execution killed with signal 6
18 Runtime error 1 ms 460 KB Execution killed with signal 6
19 Runtime error 1 ms 460 KB Execution killed with signal 6
20 Runtime error 1 ms 460 KB Execution killed with signal 6