Submission #365824

# Submission time Handle Problem Language Result Execution time Memory
365824 2021-02-12T12:32:11 Z Ahmadsm2005 Table Tennis (info1cup20_tabletennis) C++14
0 / 100
44 ms 4708 KB
#include <bits/stdc++.h>
//#define endl '\n'
#define modulo 998244353
#define int long long
#define PI acos(-1)
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#define sinDegrees(x) sin((x) * PI / 180.0)
#define cosDegrees(x) cos((x) * PI / 180.0)
#define tanDegrees(x) tan((x) * PI / 180.0)
#define atanDegrees(x) atan(x)* 180.0 / PI
#define asinDegrees(x) asin(x)* 180.0 / PI
#define EPS 0.000000001
using namespace std;
int power(int x,int y,int m)
{
int temp;
if(y == 0)
return 1;
temp = (power(x, y/2,m))%m;
if (y%2 == 0)
return ((temp%m)*temp);
else
return ((x*temp%m)*temp%m)%m;
}
int inv(int x,int m=modulo)
{
return (power(x,m-2,m))%m;
}
///IOI 2021 isA
int arr[150401],n,k;
vector<int>ANS;
bool TP(int L,int R,int X,int REM){
int F=L,S=R;
ANS.clear();
//cout<<L<<' '<<R<<' '<<X<<' '<<REM<<endl;
while((S-F+1)>REM){
//if(L==1&&R==2)
//cout<<F<<' '<<S<<' '<<REM<<endl;
if(arr[F]+arr[S]==X){
ANS.push_back(arr[F]),ANS.push_back(arr[S]);
F++,S--;
}
else if(arr[F]+arr[S]>X&&REM>0){
S--,REM--;
}
else if(REM>0){
F++,REM--;
}
else
return 0;
}
return 1;
}
int32_t main()
{
//freopen("output.txt","w",stdout);
//freopen("sorting.in","r",stdin);
cin.tie(0),iostream::sync_with_stdio(0);
cin>>n>>k;
for(int i=0;i<n+k;i++)
cin>>arr[i];
for(int i=0;i<n+k;i++){
for(int l=n+k-1;l>=n-1+i;l--){
if(TP(i+1,l-1,arr[i]+arr[l],k-((n+k-1)-l+i))){
cout<<n<<endl;
ANS.push_back(arr[i]),ANS.push_back(arr[l]);
sort(ANS.begin(),ANS.end());
for(int i=0;i<n;i++)
cout<<ANS[i]<<' ';
exit(0);
}
}
}
return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1008 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4708 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output not subsequence of input
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 492 KB Output not subsequence of input
2 Halted 0 ms 0 KB -