Submission #366009

# Submission time Handle Problem Language Result Execution time Memory
366009 2021-02-12T17:49:33 Z keta_tsimakuridze Table Tennis (info1cup20_tabletennis) C++14
0 / 100
65 ms 876 KB
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
const int N=2e5+5,mod=1e9+7;
int t,n,k,F;
vector<int >v,ans;
int a[N];
string s;
int main(){
	// t=1;
	cin>>n>>k;
	for(int i=1;i<=n+k;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int f=0;f<=k;f++){
		for(int s=0;s<=k-f;s++){
			int lft=k-s-f;
			v.clear();
			int l=f+1;
			int r=n+k-s;
			int sum=a[l]+a[r];
			while(l<r) {
				if(a[l]+a[r]==sum) v.push_back(a[l]),v.push_back(a[r]),l++,r--;
				else if(a[l]+a[r]>sum) r--,lft--;
				else l++,lft--;
				if(!lft) break;
			}
			if(v.size()>=n) {
				for(int i=0;i<n;i++){
					ans.push_back(v[i]);
				}
				sort(ans.begin(),ans.end());
				for(int i=0;i<n;i++){
					cout<<ans[i]<<" ";
				}
				F=1;
				break;
			}
		}
		if(F==1) break;
	}

}

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:30:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |    if(v.size()>=n) {
      |       ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 620 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 876 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -