Submission #754316

# Submission time Handle Problem Language Result Execution time Memory
754316 2023-06-07T13:40:58 Z jmyszka2007 Fortune Telling 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 1760 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define st first
#define nd second
constexpr int LIM = 2e5;
constexpr int SQRT = 633;
pair<int, int>tab[LIM + 10];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++) {
		cin >> tab[i].st >> tab[i].nd;
	}
	for(int i = 1; i <= k; i++) {
		int x;
		cin >> x;
		for(int j = 1; j <= n; j++) {
			if(tab[j].st <= x) {
				swap(tab[j].st, tab[j].nd);
			}
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		ans += tab[i].st;
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
14 Correct 307 ms 676 KB Output is correct
15 Correct 1187 ms 1052 KB Output is correct
16 Correct 2570 ms 1416 KB Output is correct
17 Execution timed out 3045 ms 1760 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 4 ms 340 KB Output is correct
14 Correct 307 ms 676 KB Output is correct
15 Correct 1187 ms 1052 KB Output is correct
16 Correct 2570 ms 1416 KB Output is correct
17 Execution timed out 3045 ms 1760 KB Time limit exceeded
18 Halted 0 ms 0 KB -