Submission #99198

# Submission time Handle Problem Language Result Execution time Memory
99198 2019-03-01T15:47:01 Z figter001 Garage (IOI09_garage) C++14
0 / 100
3 ms 384 KB
#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;
}

Compilation message

garage.cpp: In function 'int main()':
garage.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen("input.txt","r",stdin);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 3 ms 256 KB Output isn't correct
6 Incorrect 3 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 3 ms 384 KB Output isn't correct
9 Incorrect 3 ms 256 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 3 ms 256 KB Output isn't correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Incorrect 2 ms 384 KB Output isn't correct
14 Incorrect 2 ms 256 KB Output isn't correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Incorrect 3 ms 384 KB Output isn't correct
17 Incorrect 3 ms 256 KB Output isn't correct
18 Incorrect 2 ms 256 KB Output isn't correct
19 Incorrect 2 ms 384 KB Output isn't correct
20 Incorrect 2 ms 256 KB Output isn't correct