답안 #536169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536169 2022-03-12T14:32:52 Z timreizin Garage (IOI09_garage) C++17
40 / 100
2 ms 436 KB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> r(n), w(m);
    for (int &i : r) cin >> i;
    for (int &i : w) cin >> i;
    vector<int> slots(n);
    int res = 0;
    for (int i = 0; i < 2 * m; ++i)
    {
        int c;
        cin >> c;
        if (c > 0)
        {
            for (int j = 0; j < n; ++j)
            {
                if (slots[j] == 0)
                {
                    res += w[c - 1] * r[j];
                    slots[j] = c;
                    break;
                }
            }
        }
        else
        {
            for (int j = 0; j < n; ++j)
            {
                if (slots[j] == -c)
                {
                    slots[j] = 0;
                    break;
                }
            }
        }
    }
    cout << res;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is 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 Correct 1 ms 304 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Correct 1 ms 296 KB Output is correct
10 Incorrect 1 ms 212 KB Output isn't correct
11 Correct 1 ms 212 KB Output is correct
12 Incorrect 1 ms 212 KB Output isn't correct
13 Correct 1 ms 212 KB Output is correct
14 Incorrect 1 ms 212 KB Output isn't correct
15 Correct 2 ms 212 KB Output is correct
16 Incorrect 2 ms 316 KB Output isn't correct
17 Incorrect 2 ms 332 KB Output isn't correct
18 Incorrect 2 ms 340 KB Output isn't correct
19 Incorrect 2 ms 340 KB Output isn't correct
20 Incorrect 2 ms 436 KB Output isn't correct