#include <bits/stdc++.h>
using namespace std;
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
int a,b,c,n,m,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
cin>>n>>k;
vector<int> vec(n+k);
for(i=0;i<n+k;i++){
cin>>vec[i];
}
if(n==2){
cout<<vec[0]<<' '<<vec[1]<<endl;
return;
}
int l=0,r=n-1;
vector<int> sm(n+k);
sm[0]=vec[0];
for(i=1;i<n+k;i++){
sm[i]=sm[i-1]+vec[i];
}
for(i=0;i<=k;i++){
x=(n-2)/2;
sum=sm[i+n-1];
if(i>0)
sum-=sm[i-1];
sum-=vec[i];
sum-=vec[i+n-1];
if(sum/x==vec[i]+vec[i+n-1]){
for(j=i;j<i+n;j++){
cout<<vec[j]<<' ';
}
return;
}
}
}
main(){
ios;
int T=1;
//cin>>T;
while(T--){
solve();
}
}
Compilation message
tabletennis.cpp: In function 'void solve()':
tabletennis.cpp:22:6: warning: unused variable 'l' [-Wunused-variable]
22 | int l=0,r=n-1;
| ^
tabletennis.cpp:22:10: warning: unused variable 'r' [-Wunused-variable]
22 | int l=0,r=n-1;
| ^
tabletennis.cpp: At global scope:
tabletennis.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
44 | main(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
628 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
4044 KB |
Output is correct |
2 |
Correct |
34 ms |
4056 KB |
Output is correct |
3 |
Correct |
28 ms |
4052 KB |
Output is correct |
4 |
Correct |
25 ms |
4048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Incorrect |
0 ms |
332 KB |
Unexpected end of file - int32 expected |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
15 ms |
2644 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
15 ms |
2660 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |