๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k;
cin >> n >> k;
vector<ll> h(n);
for(auto &x:h) cin >> x;
if(k ==1){
ll total = ((n)*(n+1))/2;
cout << total;
return 0;
}
vector<pair<ll, ll>> factors;
ll temp = k;
for(ll p=2; p*p <=temp; p++){
if(temp % p ==0){
ll cnt=0;
while(temp %p ==0){
cnt++;
temp /=p;
}
factors.emplace_back(p, cnt);
}
}
if(temp >1){
factors.emplace_back(temp, 1);
}
int m = factors.size();
vector<vector<ll>> prefix(m, vector<ll>(n+1, 0));
for(int i=0;i<m;i++){
ll p = factors[i].first;
for(int j=0; j<n; j++){
ll cnt =0;
ll val = h[j];
while(val %p ==0){
cnt++;
val /=p;
}
prefix[i][j+1] = prefix[i][j] + cnt;
}
}
ll total =0;
for(int right=0; right<n; right++){
ll l_max = n;
bool valid = true;
for(int i=0;i<m;i++){
ll required = factors[i].second;
ll limit = prefix[i][right+1] - required;
if(limit <0){
valid = false;
break;
}
ll pos = upper_bound(prefix[i].begin(), prefix[i].begin()+right+2, limit) - prefix[i].begin() -1;
l_max = min(l_max, pos);
}
if(valid){
l_max = min(l_max, (ll)right+1);
total += (l_max +1);
}
}
cout << total;
}
Beautiful Garden โ
Rubrik
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n, k;
cin >> n >> k;
vector<ll> h(n);
for(auto &x:h) cin >> x;
if(k ==1){
ll total = ((n)*(n+1))/2;
cout << total;
return 0;
}
vector<pair<ll, ll>> factors;
ll temp = k;
for(ll p=2; p*p <=temp; p++){
if(temp % p ==0){
ll cnt=0;
while(temp %p ==0){
cnt++;
temp /=p;
}
factors.emplace_back(p, cnt);
}
}
if(temp >1){
factors.emplace_back(temp, 1);
}
int m = factors.size();
vector<vector<ll>> prefix(m, vector<ll>(n+1, 0));
for(int i=0;i<m;i++){
ll p = factors[i].first;
for(int j=0; j<n; j++){
ll cnt =0;
ll val = h[j];
while(val %p ==0){
cnt++;
val /=p;
}
prefix[i][j+1] = prefix[i][j] + cnt;
}
}
ll total =0;
for(int right=0; right<n; right++){
ll l_max = n;
bool valid = true;
for(int i=0;i<m;i++){
ll required = factors[i].second;
ll limit = prefix[i][right+1] - required;
if(limit <0){
valid = false;
break;
}
ll pos = upper_bound(prefix[i].begin(), prefix[i].begin()+right+2, limit) - prefix[i].begin() -1;
l_max = min(l_max, pos);
}
if(valid){
l_max = min(l_max, (ll)right+1);
total += (l_max +1);
}
}
cout << total;
}
Beautiful Garden โ
Rubrik
โค2๐คฎ1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
import sys
import threading
import bisect
def main():
import sys
sys.setrecursionlimit(1 << 25)
T = int(sys.stdin.readline())
for _ in range(T):
N, M = map(int, sys.stdin.readline().split())
children = [[] for _ in range(N + 1)]
C = [0] * (N + 1)
L = [0] * (N + 1)
for i in range(1, N + 1):
line = sys.stdin.readline()
if not line.strip():
line = sys.stdin.readline()
tokens = line.strip().split()
if len(tokens) !=3:
RM, cost, leadership = 0, 0, 0
else:
RM, cost, leadership = map(int, tokens)
if i ==1:
if RM ==1:
parent =0
else:
parent = RM
else:
parent = RM
children[parent].append(i)
C[i] = cost
L[i] = leadership
max_happiness = 0
def dfs(node):
nonlocal max_happiness
current_costs = [C[node]]
current_costs.sort()
for child in children[node]:
child_costs = dfs(child)
if len(child_costs) > len(current_costs):
current_costs, child_costs = child_costs, current_costs
merged = []
i = j =0
while i < len(current_costs) and j < len(child_costs):
if current_costs[i] < child_costs[j]:
merged.append(current_costs[i])
i +=1
else:
merged.append(child_costs[j])
j +=1
while i < len(current_costs):
merged.append(current_costs[i])
i +=1
while j < len(child_costs):
merged.append(child_costs[j])
j +=1
current_costs = merged
prefix_sums = [0]
for cost in current_costs:
prefix_sums.append(prefix_sums[-1] + cost)
k = bisect.bisect_right(prefix_sums, M) -1
happiness = L[node] * k
if happiness > max_happiness:
max_happiness = happiness
return current_costs
dfs(0)
print(max_happiness)
threading.Thread(target=main).start()
Human Resources
Rubrik โ
๐1๐ข1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Send Resume
HR@VIDYAGXP.COM
HR@VIDYAGXP.COM
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Contact Number - 9121857799
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Disperz is hiring Associate Software Engineer
For 2024, 2025 grads
Location: Chennai
https://disprz.keka.com/careers/jobdetails/68865?source=linkedin
For 2024, 2025 grads
Location: Chennai
https://disprz.keka.com/careers/jobdetails/68865?source=linkedin
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Synergy Solutions is hiring for Intern - Software Development [Fresher]
Experience: 0 - 1 year's
Expected Stipend: competitive
Apply here:https://synergysolutions.asia/careers/
Experience: 0 - 1 year's
Expected Stipend: competitive
Apply here:https://synergysolutions.asia/careers/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Check out this job at InnovateGemini: https://www.linkedin.com/jobs/view/4046963846
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int solve(string s) {
if (s.empty() || s[0] == '0') {
return 0;
}
int n = s.size();
vector<int> dp(n + 1, 0);
dp[0] = 1;
dp[1] = 1;
for (int i = 2; i <= n; ++i) {
if (s[i - 1] >= '1' && s[i - 1] <= '9') {
dp[i] += dp[i - 1];
}
int t = stoi(s.substr(i - 2, 2));
if (t >= 10 && t <= 26) {
dp[i] += dp[i - 2];
}
}
return dp[n];
}
int main() {
string s;
cin >> s;
int result = solve(s);
cout << result << endl;
return 0;
}
Decipher the numbersโ
Dream11
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Nuvama are hiring for AI ML role
Experience Range - Freshers - 2 Years of expertise!!
Location - BKC
Freshers willing to kickstart their career in AI ML role are welcome!!!!
Mail CV to - vidhi.thakkar@nuvama.com
Experience Range - Freshers - 2 Years of expertise!!
Location - BKC
Freshers willing to kickstart their career in AI ML role are welcome!!!!
Mail CV to - vidhi.thakkar@nuvama.com
๐1
import re
a = ["Inc.", "Corp.", "LLC", "L.L.C.", "LLC."]
b = ["the", "an", "a", "and"]
def normalize_name(c):
c = c.lower()
for d in a:
if c.endswith(d.lower()):
c = c[:-len(d)].strip()
c = re.sub(r'[&,]', ' ', c)
c = re.sub(r'\s+', ' ', c)
d = c.split()
if d[0] in b:
d = d[1:]
c = ' '.join(d)
return c.strip()
def check_availability(d):
e = set()
for f in d:
g, c = f.split('|')
h = normalize_name(c)
if not h:
print(f"{g}|Name Not Available")
elif h in e:
print(f"{g}|Name Not Available")
else:
e.add(h)
print(f"{g}|Name Available")
Stripe โ
๐1๐คฎ1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
https://docs.google.com/forms/d/e/1FAIpQLSe-QUx66Fwb1eAtTskuh6Cf-GDNUrPn5cZxt7NWwIw-PkxiIA/viewform
JD: https://fluttering-dry-458.notion.site/Openings-at-Multibagg-Remote-111b5a5ac6028081a508efc31414084a
JD: https://fluttering-dry-458.notion.site/Openings-at-Multibagg-Remote-111b5a5ac6028081a508efc31414084a
Google Docs
Backend Developer @ Multibagg
Weโre building an AI-powered global equity research platform that will make fundamental investing easy, rewarding, and fun for everyone. Itโs a product from India, but made for the world, aimed at giving people access to high quality financial insights.
Weโreโฆ
Weโreโฆ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Apeksha Rawat on LinkedIn: Hi Everyone,
EXL is organizing a Walkin drive at sector 144, Noida, onโฆ | 110 comments
EXL is organizing a Walkin drive at sector 144, Noida, onโฆ | 110 comments
Hi Everyone,
EXL is organizing a Walkin drive at sector 144, Noida, on 15th Oct'2024 for Back-office role.
Eligibility criteria-
โขExperience required:โฆ | 110 comments on LinkedIn
EXL is organizing a Walkin drive at sector 144, Noida, on 15th Oct'2024 for Back-office role.
Eligibility criteria-
โขExperience required:โฆ | 110 comments on LinkedIn