Submission #524587

# Submission time Handle Problem Language Result Execution time Memory
524587 2022-02-09T15:18:40 Z maks007 Table Tennis (info1cup20_tabletennis) C++14
0 / 100
28 ms 5416 KB
#include <bits/stdc++.h>
 
using namespace std;
 #define break_it (1/0)
int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector <int> a(n+k);
	function <int(vector <int>)> check=[&](vector <int> s) {
		for(int i = 0; i < n; i ++) {
			int j = i + 1;
			if(j >= n or n - i - 1 < 0 or n - j - 1 < 0) break;
			if(s[i] + s[n-i-1] == s[j]+s[n-j-1]) continue;
			return 0;
		}
		return 1;
	};
	function <void(int, int)> solve=[&](int start, int end) {
		vector <int> fors;
		
		int sum = a[start] + a[end];
		int none = -1;
		for(int i = 0; i <= n+k-1; i ++) {
			if(i + 1 > end or n - i - 1 < start) break;
			if(a[i] + a[n-i-1] > sum) {
				none = n - i - 1;
				break;
			}else if(a[i] + a[n-i-1] < sum) {
				none = i;
				break;
			}
		}
		for(int i = 0; i <= n+k-1; i ++) {
			if(none == i) continue;
			fors.push_back(a[i]);
		}
		if(check(fors)) {
		//	cout << start << " " << end << endl;
			for(auto i : fors) cout << i << " ";
			exit(0);
		}
	};	
	for(int i = 0; i < n+k; i ++) cin >> a[i];
	solve(0, n+k-1);
	solve(0, n+k-2);
	solve(1, n+k-1);
	return false;
}  
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB Extra information in the output file
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 856 KB Output is correct
2 Correct 26 ms 4504 KB Output is correct
3 Incorrect 28 ms 5416 KB Extra information in the output file
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 4448 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -