# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
99198 | figter001 | Garage (IOI09_garage) | C++14 | 3 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const ll oo = 1e18;
const ll mod = 1e9+7;
const int nax = 110;
const int mx = 2010;
ll r[nax],w[mx],at[mx];
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
int n,m;
cin>>n>>m;
set<int> st;
for(int i=1;i<=n;i++){
st.insert(i);
cin>>r[i];
}
for(int i=1;i<=m;i++)
cin>>w[i];
ll ans = 0;
queue<int> q;
for(int i=1;i<=2*m;i++){
int t;
cin>>t;
if(t > 0){
q.push(t);
}else{
t = -t;
st.insert(at[t]);
}
while(q.size() && st.size()){
t = q.front();
q.pop();
at[t] = *st.begin();
ans += w[t] * r[at[t]];
st.erase(st.begin());
}
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |