Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
Ir al canal en Telegram
Main channel https://t.me/Coding_000 Contact Admin 👉 @ILOVEU_143 for booking your exam slots Web- https://coding000.github.io/Projects/ 💯% clearance in any placement exams OffCampus -https://t.me/Offcampus_000 Discussion- https://t.me/exams_discussion
Mostrar más3 257
Suscriptores
Sin datos24 horas
-107 días
-3930 días
Archivo de publicaciones
#include <iostream>
#include <vector>
#include <deque>
#include <unordered_map>
using namespace std;
int smartTaxiDriver(int N, int K, vector<int>& T, vector<int>& P, vector<int>& C) {
unordered_map<int, vector<pair<int, int>>> g;
for (int i = 0; i < N - 1; ++i) {
g[P[i] - 1].push_back({i + 2, C[i]});
}
int mpc = 0;
for (int sn = 1; sn <= N; ++sn) {
vector<int> d(N + 1, -1);
d[sn] = 0;
deque<pair<int, int>> q = {{sn, 0}};
while (!q.empty()) {
auto [cn, cd] = q.front();
q.pop_front();
for (auto& [ne, rd] : g[cn]) {
if (d[ne] == -1 || d[ne] > cd + rd) {
d[ne] = cd + rd;
q.push_back({ne, d[ne]});
}
}
}
int pc = 0;
for (int des : T) {
if (d[des] <= K) {
pc++;
}
}
mpc = max(mpc, pc);
}
return mpc - 1;
}
int main() {
int N, K;
cin >> N >> K;
vector<int> T(N - 1), P(N - 1), C(N - 1);
for (int i = 0; i < N - 1; ++i) {
cin >> T[i];
}
for (int i = 0; i < N - 1; ++i) {
cin >> P[i];
}
for (int i = 0; i < N - 1; ++i) {
cin >> C[i];
}
int res = smartTaxiDriver(N, K, T, P, C);
cout << res << endl;
return 0;
}
Smart Taxi Driver ✅
Infosys @coding_000❤️
21 ene 2024, 06:17
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[10005][2];
const int mod = (1e9 + 7);
ll solve(ll i, ll o, ll n, ll k, vector<ll> &v) {
if (i > n) {
return 0;
}
if (dp[i][o] != -1)
return dp[i][o];
ll ans = 0;
if (o == 0) {
for (int j = i; j < min(n + 1, i + k); j++) {
ans = max(ans, solve(j + 1, 1 - o, n, k, v)) % mod;
}
} else {
ll ta = 0;
ll mx = 0;
for (int j = i; j < min(n + 1, i + k); j++) {
if (ta + v[j] >= 0) {
ta += v[j];
mx = max(mx, ta);
} else {
ta = 0;
}
ll c = solve(j + 1, 1 - o, n, k, v) % mod;
ans = max(ans, ((j - i + 1) * mx) % mod + c % mod);
}
}
return dp[i][o] = ans;
}
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v;
ll neg = 0;
for (int i = 0; i < n; i++) {
ll x;
cin >> x;
v.push_back(x);
if (x <= 0)
neg++;
}
if (neg == v.size()) {
cout << 0 << endl;
return 1;
}
memset(dp, -1, sizeof(dp));
cout << max(solve(0, 0, v.size() - 1, k, v), solve(0, 1, v.size() - 1, k, v)) << endl;
}
Array Segment
Infosys ✅
21 ene 2024, 06:17
21 ene 2024, 05:41
21 ene 2024, ~05:41
The Infosys online test for the SP role has been scheduled for Sunday,
21st January, 2024 from 2:30 PM to 5:30 PM.
The test window is stuck and the team is working from backend and it will be sorted in next 10 minutes
Don't refresh and close the window. Stay there.
The test will be starting soon and the time will be extended.
21 ene 2024, 04:43
its working....👨💻😊👍
21 ene 2024, 04:35
Guys pls check now working...
21 ene 2024, 04:32
How many facing login issue in Infosys..?
Hit like...👍👍
21 ene 2024, 04:11
Send your Coding Questions here 👇
https://t.me/exams_discussion
21 ene 2024, 04:05
21 ene 2024, ~04:12
My request to our group family don't trust anyone simply and don't lose money 🙏🥹
Team @Coding_000❤️
21 ene 2024, 04:04
21 ene 2024, ~04:12
AnimatedSticker.tgs0.02 KB
21 ene 2024, 03:42
21 ene 2024, ~03:44
How many Of u writing Infosys Exam Today ?
Give reactions....❤️
Based on reactions i will help...✅
Otherwise I will sleep..😴
Share our channel make 4.5k 🎯🎯
Share @coding_000❤️✅
20 ene 2024, 23:04
INFOSYS exam 👇👇👨💻
@Coding_000 👨💻
@Coding_000 👨💻
share to ur friends ✅ 💯
20 ene 2024, 10:23
Dm @ILOVEU_143✅
For Coding Help or Any Exam Help 😄
💯 Clearance ✅
Check the previous proofs 👆👆
Share @Coding_000❤️
19 ene 2024, 12:09
𝐇𝐞𝐥𝐥𝐨 𝐄𝐯𝐞𝐫𝐲𝐨𝐧𝐞,
𝐔𝐧𝐥𝐨𝐜𝐤 𝐲𝐨𝐮𝐫 𝐥𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐩𝐨𝐭𝐞𝐧𝐭𝐢𝐚𝐥 𝐰𝐢𝐭𝐡 𝐄𝐚𝐫𝐧𝐲𝐐𝐮𝐢𝐳! 🚀🧠 𝐃𝐚𝐢𝐥𝐲 𝐪𝐮𝐢𝐳𝐳𝐞𝐬, 𝐫𝐞𝐚𝐥 𝐫𝐞𝐰𝐚𝐫𝐝𝐬. 𝐉𝐨𝐢𝐧 𝐧𝐨𝐰: https://www.earnyquiz.in/ 🌟 #𝐂𝐨𝐧𝐭𝐢𝐧𝐮𝐨𝐮𝐬𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠 #𝐄𝐚𝐫𝐧𝐲𝐐𝐮𝐢𝐳
19 ene 2024, 00:05
Dm @ILOVEU_143✅
For Coding Help or Any Exam Help 😄
💯 Clearance ✅
Check the previous proofs 👆👆
Share @Coding_000❤️
18 ene 2024, 01:03
TECH Mahindra Exam
Round 2
Help available.👨💻
100% Clearance GUARANTEE.✅
Check our past Results. 👇👇
https://t.me/Coding_000/5567?single
https://t.me/Coding_000/5563?single
Contact @ILOVEU_143 ✅
17 ene 2024, 09:29
👉🏻Hello guy's Anyone Need EXAM ASSISTANCE....📖🖋️
✅DUOLINGO - 125+🔥
✅GRE - 315+
✅TOEFL - 90+
📥DM me @ILOVEU_143 ❤️for above exam assistance..😊
Share @coding_000✅
15 ene 2024, 11:02
HCL INTERNAL EXAM Cleared🥳😍❤️
Congratulations 🎉🎉🥳
Client Feedback 😅😊
Share @Coding_000❤️
15 ene 2024, 00:30
HCL INTERNAL EXAM Cleared🥳😍❤️
Congratulations 🎉🎉🥳
Helped Proof 👇👇
https://t.me/Coding_000/6008?single
Any exam Book your slot ✅
Contact here @ILOVEU_143❤️
100% clearance guarantee 🔥🔥
Share my channel with your friends and college groups🥳
Trust us Expect us ❤️
15 ene 2024, 00:19
