Submission #888334

# Submission time Handle Problem Language Result Execution time Memory
888334 2023-12-17T01:45:01 Z hwy Fortune Telling 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 3032 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n, k;
  	cin >> n >> k;
	vector<pair<ll, ll>> cards;
	vector<ll> ops;
	ll ans = 0;
	ll curr_num;
	
	for (ll i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		cards.push_back({a, b});
	}
	
	for (ll i = 0; i < k; i++) {
		ll temp;
		cin >> temp;
		ops.push_back(temp);
	}
	
	for (ll i = 0; i < n; i++) {
		curr_num = cards[i].first;
		for (ll j = 0; j < k; j++) {
			if (curr_num <= ops[j]) {
				if (curr_num == cards[i].first)
					curr_num = cards[i].second;
				else if (curr_num == cards[i].second)
					curr_num = cards[i].first;
			}
		}
		ans += curr_num;
	}
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 464 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 508 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 3 ms 524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 464 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 508 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 3 ms 524 KB Output is correct
14 Correct 266 ms 1116 KB Output is correct
15 Correct 1047 ms 2004 KB Output is correct
16 Correct 2335 ms 2288 KB Output is correct
17 Execution timed out 3055 ms 3032 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 464 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 508 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 3 ms 524 KB Output is correct
14 Correct 266 ms 1116 KB Output is correct
15 Correct 1047 ms 2004 KB Output is correct
16 Correct 2335 ms 2288 KB Output is correct
17 Execution timed out 3055 ms 3032 KB Time limit exceeded
18 Halted 0 ms 0 KB -