제출 #138449

#제출 시각아이디문제언어결과실행 시간메모리
138449baluteshihGarage (IOI09_garage)C++14
100 / 100
3 ms420 KiB
#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) 메시지

garage.cpp: In function 'int main()':
garage.cpp:38:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(used.count()==n) q.push(x);
       ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...