답안 #973025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973025 2024-05-01T12:34:27 Z kiddi Garage (IOI09_garage) C++17
30 / 100
2 ms 600 KB
#include <bits/stdc++.h>
#include <queue>
using namespace std;

int n, m;
int val[101];
int tingd[2001];
map<int, int> hvar;
priority_queue<int> rod;
queue<int> bilar;
int tala;
int svar = 0;

int main() {
    cin >> n >> m;
    for (int x = 1; x < 1+n; x++) {
        cin >> val[x];
        rod.push(-x);
    }
    for (int x = 1; x < 1+m; x++) {
        cin >> tingd[x];
    }
    for (int x = 0; x < m*2; x++) {
        cin >> tala;
        if (tala > 0) {
            if (!rod.empty()) {
                hvar[tala] = abs(rod.top());
                rod.pop();
                //cout << hvar[tala] << ' ' << tala << ' ' << val[hvar[tala]]*tingd[tala] << endl;
                svar += val[hvar[tala]]*tingd[tala];
            }
            else {
                bilar.push(tala);
            }
        }
        else {
            tala = -tala;
            rod.push(hvar[tala]);
            if (!bilar.empty()) {
                tala = bilar.front();
                bilar.pop();
                hvar[tala] = abs(rod.top());
                rod.pop();
                //cout << "??" << endl;
                svar += val[hvar[tala]]*tingd[tala];
            }
        }
        
    }
    cout << svar << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 1 ms 348 KB Output isn't correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 1 ms 348 KB Output isn't correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Incorrect 1 ms 348 KB Output isn't correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Incorrect 1 ms 348 KB Output isn't correct
17 Incorrect 2 ms 348 KB Output isn't correct
18 Incorrect 2 ms 348 KB Output isn't correct
19 Correct 2 ms 348 KB Output is correct
20 Incorrect 2 ms 348 KB Output isn't correct