답안 #168963

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168963 2019-12-17T10:05:21 Z dolphingarlic Garage (IOI09_garage) C++14
컴파일 오류
0 ms 0 KB
a#include <bits/stdc++.h>
#pragma GCC Optimize("O3")
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;

priority_queue<int> pq;
int r[100], w[2001], curr[2001];

int main() {
    iostream::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    FOR(i, 0, n) {
        cin >> r[i];
        pq.push(-i);
    }

    int ans = 0;
    FOR(i, 1, m + 1) cin >> w[i];

    queue<int> q;
    FOR(i, 0, 2 * m) {
        int c;
        cin >> c;
        if (c > 0) q.push(c);
        else pq.push(-curr[-c]);

        while (pq.size() && q.size()) {
            curr[q.front()] = -pq.top();
            ans += w[q.front()] * r[-pq.top()];
            pq.pop(); q.pop();
        }
    }

    cout << ans;
    return 0;
}

Compilation message

garage.cpp:1:2: error: stray '#' in program
 a#include <bits/stdc++.h>
  ^
garage.cpp:2:0: warning: ignoring #pragma GCC Optimize [-Wunknown-pragmas]
 #pragma GCC Optimize("O3")
 
garage.cpp:1:1: error: 'a' does not name a type
 a#include <bits/stdc++.h>
 ^
garage.cpp:8:1: error: 'priority_queue' does not name a type
 priority_queue<int> pq;
 ^~~~~~~~~~~~~~
garage.cpp: In function 'int main()':
garage.cpp:12:5: error: 'iostream' has not been declared
     iostream::sync_with_stdio(false);
     ^~~~~~~~
garage.cpp:13:5: error: 'cin' was not declared in this scope
     cin.tie(0);
     ^~~
garage.cpp:13:5: note: suggested alternative: 'main'
     cin.tie(0);
     ^~~
     main
garage.cpp:18:9: error: 'pq' was not declared in this scope
         pq.push(-i);
         ^~
garage.cpp:24:5: error: 'queue' was not declared in this scope
     queue<int> q;
     ^~~~~
garage.cpp:24:11: error: expected primary-expression before 'int'
     queue<int> q;
           ^~~
garage.cpp:28:20: error: 'q' was not declared in this scope
         if (c > 0) q.push(c);
                    ^
garage.cpp:29:14: error: 'pq' was not declared in this scope
         else pq.push(-curr[-c]);
              ^~
garage.cpp:31:16: error: 'pq' was not declared in this scope
         while (pq.size() && q.size()) {
                ^~
garage.cpp:31:29: error: 'q' was not declared in this scope
         while (pq.size() && q.size()) {
                             ^
garage.cpp:38:5: error: 'cout' was not declared in this scope
     cout << ans;
     ^~~~