Code discussion
Contest Watcher, [24.10.20 14:08] Codeforces Round #678 (Div. 2) (2h) starts in 5h 27m Technocup 2021 - Elimination Round 1 (2h) starts in 1d 2h 27m Codeforces Round #679 (Div. 2, based on Technocup 2021 Elimination Round 1) (2h) starts in 1d 2h 27m Codeforces…
Codeforces
Codeforces Round #678 (Div. 2) - Codeforces
Codeforces. Programming competitions and contests, programming community
have you tried this question ? Bandit in a city
https://codeforces.com/contest/1436/problem/D
https://codeforces.com/contest/1436/problem/D
Anonymous Poll
25%
yes
75%
no
October Lunchtime 2020 (3h)
starts in 2d 7h 21m
Codeforces Round #680 (Div. 2, based on Moscow Team Olympiad) (2h)
starts in 3d 4h 26m
Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad) (2h)
starts in 3d 4h 26m
Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) (2h)
starts in 4d 7h 56m
Codeforces Round #681 (Div. 1, based on VK Cup 2019-2020 - Final) (2h)
starts in 4d 7h 56m
SRM 793 (2h)
starts in 6d 19h 21m
Kotlin Heroes 5: ICPC Round (Practice) (168h)
starts in 7d 6h 56m
And other 1 scheduled in the next 2 weeks...
starts in 2d 7h 21m
Codeforces Round #680 (Div. 2, based on Moscow Team Olympiad) (2h)
starts in 3d 4h 26m
Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad) (2h)
starts in 3d 4h 26m
Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) (2h)
starts in 4d 7h 56m
Codeforces Round #681 (Div. 1, based on VK Cup 2019-2020 - Final) (2h)
starts in 4d 7h 56m
SRM 793 (2h)
starts in 6d 19h 21m
Kotlin Heroes 5: ICPC Round (Practice) (168h)
starts in 7d 6h 56m
And other 1 scheduled in the next 2 weeks...
Reminder🔔
https://www.technicalkeeda.in/2020/10/code-chef-november-long-challenge-solution.html
do not forget to participate november long challenge
https://www.technicalkeeda.in/2020/10/code-chef-november-long-challenge-solution.html
do not forget to participate november long challenge
Technical Keeda
Codechef November long challenge solution | November long challenge solution
#include <bits/stdc++.h>
using namespace std;
#define int long long int
bool cmp(int a,int b){
if(a>b){
return true;
}
else{
return false;
}
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
int n,x;
cin>>n>>x;
vector<int > v1;
vector<int > v2;
for(int i=0;i<n;i++){
int k;
cin>>k;
v1.push_back(k);
}
for(int i=0;i<n;i++){
int k;
cin>>k;
v2.push_back(k);
}
// sort(v1.begin(),v1.end());
sort(v2.begin(),v2.end());
int j=n-1;
bool check=true;
for(int i=0;i<n;i++){
if(v1[i]+v2[j]>x){
cout<<"NO"<<endl;
check=false;
break;
}
j--;
}
if(check){
cout<<"YES"<<endl;
}
}
}
First question solution
using namespace std;
#define int long long int
bool cmp(int a,int b){
if(a>b){
return true;
}
else{
return false;
}
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
int n,x;
cin>>n>>x;
vector<int > v1;
vector<int > v2;
for(int i=0;i<n;i++){
int k;
cin>>k;
v1.push_back(k);
}
for(int i=0;i<n;i++){
int k;
cin>>k;
v2.push_back(k);
}
// sort(v1.begin(),v1.end());
sort(v2.begin(),v2.end());
int j=n-1;
bool check=true;
for(int i=0;i<n;i++){
if(v1[i]+v2[j]>x){
cout<<"NO"<<endl;
check=false;
break;
}
j--;
}
if(check){
cout<<"YES"<<endl;
}
}
}
First question solution