| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 138449 | baluteshih | Garage (IOI09_garage) | C++14 | 3 ms | 420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ET cout << "\n"
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define MEM memset(i,j,sizeof i)
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int price[105],wei[2005],pl[2005];
bitset<105> used;
queue<int> q;
int main()
{jizz
int n,m,x,ans=0;
cin >> n >> m;
for(int i=1;i<=n;++i)
cin >> price[i];
for(int i=1;i<=m;++i)
cin >> wei[i];
for(int i=1;i<=2*m;++i)
{
cin >> x;
if(x<0)
{
used[pl[-x]]=0;
if(!q.empty())
pl[q.front()]=pl[-x],ans+=wei[q.front()]*price[pl[-x]],q.pop(),used[pl[-x]]=1;
}
else
if(used.count()==n) q.push(x);
else
{
for(int j=1;j<=n;++j)
if(!used[j])
{
pl[x]=j,ans+=wei[x]*price[j],used[j]=1;
break;
}
}
}
cout << ans << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
