Submission #335140

# Submission time Handle Problem Language Result Execution time Memory
335140 2020-12-11T08:33:49 Z VodkaInTheJar Fortune Telling 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 2028 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define endl '\n'

using namespace std;

const int maxn = 2e5 + 3; 

int n, k; 
int a[maxn][2], t[maxn];
void read()
{
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	cin >> a[i][0] >> a[i][1];
	
	for (int i = 1; i <= k; i++)
	cin >> t[i];
}

void solve()
{
	long long ans = 0;
	for (int i = 1; i <= n; i++)
	{
		bool is = false;
		for (int j = 1; j <= k; j++)
		if (t[j] >= a[i][is])
		is ^= 1; 
		
		ans += a[i][is];
	}
	
	cout << ans << endl; 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	read();
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 492 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 492 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 341 ms 528 KB Output is correct
15 Correct 1343 ms 664 KB Output is correct
16 Correct 2975 ms 876 KB Output is correct
17 Execution timed out 3076 ms 2028 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 492 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 341 ms 528 KB Output is correct
15 Correct 1343 ms 664 KB Output is correct
16 Correct 2975 ms 876 KB Output is correct
17 Execution timed out 3076 ms 2028 KB Time limit exceeded
18 Halted 0 ms 0 KB -