Submission #431232

# Submission time Handle Problem Language Result Execution time Memory
431232 2021-06-17T10:28:11 Z faresbasbs Fortune Telling 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 460 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int n,k,a[40001],b[40001];

int main(){
	cin >> n >> k;
	for(int i = 1 ; i <= n ; i += 1){
		cin >> a[i] >> b[i];
	}
	for(int i = 1 ; i <= k ; i += 1){
		int f;
		cin >> f;
		for(int j = 1 ; j <= n ; j += 1){
			if(a[j] <= f){
				swap(a[j],b[j]);
			}
		}
	}
	long long ans = 0;
	for(int i = 1 ; i <= n ; i += 1){
		ans += a[i];
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 5 ms 204 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 5 ms 204 KB Output is correct
6 Correct 4 ms 204 KB Output is correct
7 Correct 4 ms 204 KB Output is correct
8 Correct 5 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 3 ms 204 KB Output is correct
11 Correct 4 ms 204 KB Output is correct
12 Correct 4 ms 204 KB Output is correct
13 Correct 5 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 5 ms 204 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 5 ms 204 KB Output is correct
6 Correct 4 ms 204 KB Output is correct
7 Correct 4 ms 204 KB Output is correct
8 Correct 5 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 3 ms 204 KB Output is correct
11 Correct 4 ms 204 KB Output is correct
12 Correct 4 ms 204 KB Output is correct
13 Correct 5 ms 308 KB Output is correct
14 Correct 360 ms 372 KB Output is correct
15 Correct 1389 ms 332 KB Output is correct
16 Execution timed out 3059 ms 460 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 5 ms 204 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 5 ms 204 KB Output is correct
6 Correct 4 ms 204 KB Output is correct
7 Correct 4 ms 204 KB Output is correct
8 Correct 5 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 3 ms 204 KB Output is correct
11 Correct 4 ms 204 KB Output is correct
12 Correct 4 ms 204 KB Output is correct
13 Correct 5 ms 308 KB Output is correct
14 Correct 360 ms 372 KB Output is correct
15 Correct 1389 ms 332 KB Output is correct
16 Execution timed out 3059 ms 460 KB Time limit exceeded
17 Halted 0 ms 0 KB -