Submission #524453

# Submission time Handle Problem Language Result Execution time Memory
524453 2022-02-09T08:46:43 Z maks007 Table Tennis (info1cup20_tabletennis) C++14
20 / 100
59 ms 7940 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;
	};
	for(int i = 0; i < n+k; i ++) cin >> a[i];
	if(k == 1 and n <= 2000) { 
		for(int i = 0; i < n + k; i ++) {
			vector <int> v;
			for(int j = 0; j < n + k; j ++) {
				if(i == j) continue;
				v.push_back(a[j]);
			}
			if(check(v)){
				for(auto i : v) cout << i << " ";
				return false;
			}
		}
	}else if(n+k<=18) {
		for(int i = 0; i < n; i ++) cout << a[i] << " ";
	}else {
		int l = 0, r = n+k-1;
		set <int> none;
		while(1) {
			if( l >= r) break;
			if(a[l] + a[r] != a[l+1] + a[r-1]) {
				none.insert(r);
				r --;
			}else {
				l ++;
				r --;
			}
		}
		for(int i = 0; i < n+k; i ++) {
			if(none.count(i)) continue;
			cout << a[i] << " ";
		}
	}
	return false;
}   
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 8 ms 332 KB Output is correct
3 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 588 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 7876 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 332 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 56 ms 7820 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 56 ms 7940 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -