제출 #733916

#제출 시각아이디문제언어결과실행 시간메모리
733916vjudge1Garage (IOI09_garage)C++17
40 / 100
2 ms468 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int t, n, m, ans, i, z,j, x, r, p, s, y; cin >> n >> m; ll a[n + 2], b[m + 2], c[m + 2]; ans = 0; priority_queue < ll , vector < ll > , greater< ll >> pq; for ( i = 1; i <= n; i ++) { cin >> a[i]; pq.push(i); } for ( i = 1; i <= m; i ++) { cin >> b[i]; } queue < ll > q; for ( i = 1; i <= 2 * m; i ++) { cin >> x; if ( x < 0) { r = -x; pq.push(c[r]); } else { if ( pq.empty()) { q.push(x); } p = pq.top(); pq.pop(); c[x] = p; ans += (a[p] * b[x]); } if ( !pq.empty() && !q.empty()) { x = q.front(); q.pop(); p = pq.top(); pq.pop(); c[x] = p; ans += (a[p] * b[x]); } } cout << ans << endl; }

컴파일 시 표준 에러 (stderr) 메시지

garage.cpp: In function 'int main()':
garage.cpp:6:6: warning: unused variable 't' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, r, p, s, y;
      |      ^
garage.cpp:6:23: warning: unused variable 'z' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, r, p, s, y;
      |                       ^
garage.cpp:6:25: warning: unused variable 'j' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, r, p, s, y;
      |                         ^
garage.cpp:6:37: warning: unused variable 's' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, r, p, s, y;
      |                                     ^
garage.cpp:6:40: warning: unused variable 'y' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, r, p, s, y;
      |                                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...