# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
733903 | vjudge1 | Garage (IOI09_garage) | C++17 | 2 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ff first
#define ss second
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
const int max6 = 2e6 + 1;
const int max5 = 2e5 + 1;
const int max9 = 1e9 + 1;
const int mod = 1e9 + 7;
const long long infinity = 1e15 + 7;
vector<int> order;
vector<int> wait;
int n, m, income;
int cost[101], w[2001], gar[2001], av[2001];
void into(int a) {
int j;
for (j = 1; j <= n; j++)
if (av[j] == 0) {
gar[a] = j;
av[j] = 1;
income += cost[j] * w[a];
return;
}
wait.pb(a);
}
int32_t main() {
fastio;
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> cost[i];
for (int i = 1; i <= m; i++)
cin >> w[i];
for (int i = 0; i < 2 * m; i++) {
int a; cin >> a;
if (a > 0) {
into(a);
}
else {
a = abs(a);
if (gar[a] == 0) {
for (int j = 0; j < wait.size(); j++)
if (wait[j] == a) {
wait.erase(wait.begin() + j);
break;
}
}
else {
av[gar[a]] = 0;
}
}
}
cout << income;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |