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
If anyone having Cisco exam today dm @Cpsoln to book the slot
Repost from Codeforces|Leetcode|Codechef free solutions
If you refer your friends for OA you will get 50Rs discount
Dm @Cpsoln
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 <vector>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
while (t > 0) {
string s;
cin >> s;
vector<vector<int>> pos(10);
vector<int> idx(10, 0);
for (int i = 0; i < s.length(); i++) {
int digit = s[i] - '0';
pos[digit].push_back(i);
}
int m;
cin >> m;
string lr, rr;
cin >> lr >> rr;
int cpos = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < 10; j++) {
while (idx[j] < pos[j].size() && pos[j][idx[j]] < cpos) {
idx[j]++;
}
}
int pck = cpos;
for (int j = lr[i] - '0'; j <= rr[i] - '0'; j++) {
if (idx[j] >= pos[j].size()) {
pck = s.length();
} else {
pck = max(pck, pos[j][idx[j]]);
}
}
cpos = pck + 1;
}
if (cpos >= s.length() + 1) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
t--;
}
return 0;
}
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
while (t > 0) {
string s;
cin >> s;
vector<vector<int>> pos(10);
vector<int> idx(10, 0);
for (int i = 0; i < s.length(); i++) {
int digit = s[i] - '0';
pos[digit].push_back(i);
}
int m;
cin >> m;
string lr, rr;
cin >> lr >> rr;
int cpos = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < 10; j++) {
while (idx[j] < pos[j].size() && pos[j][idx[j]] < cpos) {
idx[j]++;
}
}
int pck = cpos;
for (int j = lr[i] - '0'; j <= rr[i] - '0'; j++) {
if (idx[j] >= pos[j].size()) {
pck = s.length();
} else {
pck = max(pck, pos[j][idx[j]]);
}
}
cpos = pck + 1;
}
if (cpos >= s.length() + 1) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
t--;
}
return 0;
}
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
vector < int > adj[10001];
bool g[10001][10001];
int color[10001];
const int MAXN = 105;
ull t;
void solve()
{
int ax , ay , bx , by , cx , cy;
cin >> ax >> ay >> bx >> by >> cx >> cy;
int ans = 1;
if((bx < ax and cx < ax) or (bx > ax and cx > ax))
{
ans += min(abs(bx - ax) , abs(cx - ax));
}
if((by < ay and cy < ay) or (by > ay and cy > ay))
{
ans += min(abs(by - ay) , abs(cy - ay));
}
cout << ans << endl;
}
int main()
{
int t;
cin >> t;
while(t--)
{
solve();
}
}
After 4.5k subscribers I will upload C
in the channel 😊😊😊
int ax, ay, bx, by, cx, cy;
cin >> ax >> ay >> bx >> by >> cx >> cy;
int ans = 1;
if ((bx < ax and cx < ax) or (bx > ax and cx > ax))
ans += min(abs(bx - ax), abs(cx - ax));
if ((by < ay and cy < ay) or (by > ay and cy > ay))
ans += min(abs(by - ay), abs(cy - ay));
cout << ans << endl;
Don't buy solutions guys if you are getting for free
void solve()
{
ll n, k, x;
cin >> n >> k >> x;
if (x != 1)
{
cout << "YES" << nline;
cout << n << nline;
for (int i = 1; i < n + 1; i++)
{
cout << 1 << " ";
}
cout << nline;
return;
}
if (n == 1 || k <= 1)
{
cout << "NO" << nline;
return;
}
if (n % 2 == 0)
{
cout << "YES" << nline;
cout << n / 2 << nline;
for (int i = 1; i <= n / 2; i++)
{
cout << 2 << " ";
}
cout << nline;
return;
}
if (k > 2)
{
cout << "YES" << nline;
cout << (n - 3) / 2 + 1 << nline;
for (int i = 1; i <= (n - 3) / 2; i++)
{
cout << 2 << " ";
}
cout << 3;
cout << nline;
return;
}
cout << "NO" << nline;
}
