답안 #555269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
555269 2022-04-30T10:59:57 Z OrazB Garage (IOI09_garage) C++17
0 / 100
2 ms 468 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 20005;
 
 priority_queue <pair <int, int>, vector<pair <int, int>>, greater<pair <int, int>>> v;
 
queue <int> q;
 
int a, b[N], l, n, kl;
 
int sum;
 
map <int, vector <pair <int, int>>> m;
 
 
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 	cin >> n >> kl;
 	for (int i = 1; i <= n; ++i) {
 		cin >> a;
 		v.push({i, a});
 	}
 	for (int i = 1; i <= kl; ++i) {
 		cin >> b[i];
 	}
 	int jp = 2 * kl;
 	while ( jp-- ) {
 		cin >> l;
 		if (l > 0) q.push(l);
 		int a1 = 0;
 		if (q.size()) a1 = q.front();
 		else continue;
 		if (l > 0) {
 			if (!v.empty()) {
 				if (q.size()) q.pop();
 				m[a1].pb ({v.top().first,v.top().second});
 				v.pop();
 			}
 		}else{
 			l *= -1;
 			sum += (b[l] * m[l][0].ss);
 			v.push({m[l][0].ff,m[l][0].ss});
 			m[l].clear();
 			if (a1 > 0) {
 				if (!v.empty()) {
 					if (q.size()) q.pop();
 					m[a1].pb ({v.top().first,v.top().second});
 					v.pop();
 				}		
 			}
 		}
 	} 
 	cout << sum << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Incorrect 0 ms 212 KB Output isn't correct
4 Runtime error 1 ms 468 KB Execution killed with signal 11
5 Runtime error 1 ms 468 KB Execution killed with signal 11
6 Incorrect 0 ms 212 KB Output isn't correct
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Runtime error 1 ms 468 KB Execution killed with signal 11
9 Runtime error 1 ms 468 KB Execution killed with signal 11
10 Incorrect 0 ms 340 KB Output isn't correct
11 Runtime error 1 ms 468 KB Execution killed with signal 11
12 Runtime error 1 ms 468 KB Execution killed with signal 11
13 Runtime error 1 ms 468 KB Execution killed with signal 11
14 Runtime error 1 ms 468 KB Execution killed with signal 11
15 Runtime error 1 ms 468 KB Execution killed with signal 11
16 Runtime error 1 ms 468 KB Execution killed with signal 11
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Runtime error 1 ms 468 KB Execution killed with signal 11
19 Incorrect 2 ms 468 KB Output isn't correct
20 Runtime error 1 ms 468 KB Execution killed with signal 11