Submission #366012

# Submission time Handle Problem Language Result Execution time Memory
366012 2021-02-12T18:00:46 Z keta_tsimakuridze Table Tennis (info1cup20_tabletennis) C++14
0 / 100
63 ms 1004 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];
int  main(){
	cin>>n>>k;
	for(int i=1;i<=n+k;i++){
		cin>>a[i];
	}
	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;
				return 0;
			}
		}
	}
	return 0;

}

Compilation message

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:27:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |    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 9 ms 620 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 1004 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 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 63 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -