답안 #994592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994592 2024-06-08T02:07:47 Z ducksaysquack Garage (IOI09_garage) C++
40 / 100
1000 ms 348 KB
#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

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];
      |                                    ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Execution timed out 1087 ms 348 KB Time limit exceeded
3 Correct 0 ms 344 KB Output is correct
4 Execution timed out 1094 ms 348 KB Time limit exceeded
5 Correct 1 ms 344 KB Output is correct
6 Execution timed out 1055 ms 348 KB Time limit exceeded
7 Correct 1 ms 344 KB Output is correct
8 Execution timed out 1061 ms 348 KB Time limit exceeded
9 Correct 0 ms 348 KB Output is correct
10 Execution timed out 1095 ms 348 KB Time limit exceeded
11 Correct 0 ms 348 KB Output is correct
12 Execution timed out 1099 ms 348 KB Time limit exceeded
13 Correct 0 ms 344 KB Output is correct
14 Execution timed out 1088 ms 348 KB Time limit exceeded
15 Correct 1 ms 344 KB Output is correct
16 Execution timed out 1095 ms 348 KB Time limit exceeded
17 Execution timed out 1046 ms 344 KB Time limit exceeded
18 Execution timed out 1050 ms 344 KB Time limit exceeded
19 Execution timed out 1012 ms 344 KB Time limit exceeded
20 Execution timed out 1006 ms 348 KB Time limit exceeded