Submission #994592

#TimeUsernameProblemLanguageResultExecution timeMemory
994592ducksaysquackGarage (IOI09_garage)C++98
40 / 100
1099 ms348 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int n, k; cin >> n >> k; vector<int> a(n), b(k), c(k);
	for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<k;i++) cin >> b[i];
	set<int> s; int ans = 0;
	for(int i=0;i<n;i++) s.insert(i);
	for(int i=0;i<2*k;i++) {
		int x; cin >> x;
		if(x>0) {ans += a[*s.begin()]*b[x-1], c[x-1]=*s.begin(); s.erase(s.begin());}
		else s.insert(c[-x-1]);
	}
	cout << ans;
}

Compilation message (stderr)

garage.cpp: In function 'int main()':
garage.cpp:7:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    7 |  for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<k;i++) cin >> b[i];
      |  ^~~
garage.cpp:7:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    7 |  for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<k;i++) cin >> b[i];
      |                                    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...