Codeforces|Leetcode|Codechef free solutions
Open in Telegram
Free codeforces, Codechef, Leetcode solutions are available 😍😍😍😍😍😍 Helped More than 200+ students to crack coding round in 2022 and helped placed them in Good companies. 🥳🥳🥳🤩🤩🤩 Dm @Cpsoln if you want help in coding round.
Show more4 317
Subscribers
No data24 hours
-137 days
-5230 days
Posts Archive
Guys don't buy code from anyone and save your money from scammers 😀😀
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define loop(n) for(long long i=0;i<n;i++)
signed main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output1.txt","w",stdout);
#endif
int t;
cin>>t;
while(t--){
ll n,x,m;
cin>>n>>m;
ll right=0,left=0,p=0;
std::vector<ll> v;
set<ll>s;
v.pb(-1);
loop(n){
cin>>x;
if(x==-2)left++;
else if(x==-1)right++;
else {p++;s.insert(x);}
}
for(auto it:s)v.pb(it);
v.pb(-2);
ll ans=0;
loop(v.size()){
x=v[i];
if(i==0){
ans=max(ans,min(left+v.size()-2,m));
}
else if(i==v.size()-1){
ans=max(ans,min(right+v.size()-2,m));
}
else {
ans=max(ans,1+min(right+i-1,x-1)+min(left+(v.size()-i-2),m-x));
}
}
cout<<ans<<"\n";
}
return 0;
}
C will be uploaded soon guys
Share the channel🔥🔥🔥🔥🔥🔥
Repost from Codeforces|Leetcode|Codechef free solutions
Since your placement and intern session is coming 🤓🤓
So don't miss any opportunity in this recession😇😇😇😇
📌📌📌📌📌📌📌📌📌📌📌📌
No scam No fraud because we are not like other telegram channels.
If you want help in coding round of any company then Dm @Cpsoln and book your slot ✅✅✅✅
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
void sol(){
int n,m;
cin>>n>>m;
int a[n*m];
for(auto &x:a) cin>>x;
sort(a,a+n*m);
int x = a[n*m-1];
int p = a[0];
int q = a[1];
int y= a[n*m-2];
// cout<<x<<" "<<y<<" "<<z<<" "<<xx<<" "<<m<<" "<<n<<endl;
int count = (n-1)*(x-q);
count+=(n)*(m-1)*(x-p);
int ans = (n-1)*(y-p);
ans+=(m-1)*n*(x-p);
swap(n,m);
int count2 = (n-1)*(x-q);
count2+=(n)*(m-1)*(x-p);
int ans2 = (n-1)*(y-p);
ans2+=(m-1)*n*(x-p);
cout<<max(max(ans,ans2),max(count,count2))<<endl;
return;
}
signed main() {
int t;
cin>>t;
while(t--){
sol();
}
return 0;
}
#include<bits/stdc++.h>
#define int long long int
#define F first
#define S second
#define pb push_back
#define que_max priority_queue<int>
#define que_min priority_queue<int,vector<int>,greater<int>>;
#define endl "\n"
using namespace std;
int32_t main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int32_t t;
cin>>t;
while(t--)
{
string s;
cin>>s;
int flag=0;
for(int i=0;i<s.size()-1;i++)
{
if(s[i]!=s[i+1])
{
flag=1;
break;
}
}
if(flag==1)
{
cout<<s.size()-1<<endl;
}else
{
cout<<"-1"<<endl;
}
}
return 0;
}
Repost from Codeforces|Leetcode|Codechef free solutions
Since your placement and intern session is coming 🤓🤓
So don't miss any opportunity in this recession😇😇😇😇
📌📌📌📌📌📌📌📌📌📌📌📌
No scam No fraud because we are not like other telegram channels.
If you want help in coding round of any company then Dm @Cpsoln and book your slot ✅✅✅✅
Start sharing the channel links to yours friends and share me the telegram username of the friend or you can dm me the screen shot.
There willl be multiple winner's:
Rank 1: 200Rs Amazon gift card
Rank 2: 150Rs Amazon gift card
Rank 3: 100Rs Amazon gift card
Rank 4: 2 questions will be free of cost in coding round
Rank 5: 1 question will be free of cost in coding round
This will end at 2nd May at 8:00 pm
Rules for the giveaway:
There will be multiple winners
1) To be the winner you have to subscribe the channel and unmute the notifications otherwise you will be discarded.
2) You have to share the channel @contestsolution to as many people as you can and they have to join the channel and you have to send the telegram username of that person to me who have join so that I can count the no of referrals.
3) The person who referred more people will be the winner.
Best of luck guys.
Should be do a giveaway of 200Rs as a Amazon gift card? 😍😍😍😍😍
Repost from Codeforces|Leetcode|Codechef free solutions
Since your placement and intern session is coming 🤓🤓
So don't miss any opportunity in this recession😇😇😇😇
📌📌📌📌📌📌📌📌📌📌📌📌
No scam No fraud because we are not like other telegram channels.
If you want help in coding round of any company then Dm @Cpsoln and book your slot ✅✅✅✅
Kaisa lga guys Sare code de diya kisi channel ne d upload nhi kiya abhi tak
Channel share krdo guys
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n, k, c[MAXN];
vector<int> pos[MAXN];
bool vis[MAXN];
bool check(int m) {
int cnt = 0;
memset(vis, false, sizeof(vis));
for (int i = 1; i <= m; i++) {
for (int j = 0; j < pos[i].size(); j++) {
int l = pos[i][j], r = l + i - 1;
if (r <= m) {
if (!vis[l]) {
cnt++;
vis[l] = true;
}
} else {
break;
}
}
if (cnt > c[m]) {
return false;
}
}
return cnt == c[m];
}
int main() {
int t;
cin >> t;
while (t--) {
cin >> n >> k;
for (int i = 1; i <= n; i++) {
pos[i].clear();
}
for (int i = 1; i <= k; i++) {
int x;
cin >> x;
pos[x].push_back(i);
}
for (int i = 1; i <= k; i++) {
cin >> c[i];
}
bool found = false;
string ans(n, 'a');
for (int i = 1; i <= n; i++) {
if (check(i)) {
found = true;
break;
}
ans[i - 1]++;
}
if (found) {
cout << "YES\n" << ans << "\n";
} else {
cout << "NO\n";
}
}
return 0;
}
