| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 293949 | kshitij_sodani | Garage (IOI09_garage) | C++14 | 2 ms | 416 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
int n,m;
int it[101];
int aa[2001];
int pp[2001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
queue<int> ss;
cin>>n>>m;
set<int> cur;
for(int i=0;i<n;i++){
cur.insert(i);
}
for(int i=0;i<n;i++){
cin>>it[i];
}
for(int i=0;i<m;i++){
cin>>aa[i];
}
int ans=0;
for(int i=0;i<2*m;i++){
int ind;
cin>>ind;
if(ind<0){
cur.insert(pp[-ind]);
}
else{
ss.push(ind);
}
while(cur.size() and ss.size()){
int x=ss.front();
ss.pop();
int y=*(cur.begin());
cur.erase(y);
ans+=aa[x-1]*it[y];
pp[x]=y;
}
}
cout<<ans<<endl;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
