#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a;
cin >> a;
vector<pair<int,int>> b(a), c(a);
set<int> d;
for (int i = 0; i < a; i++) {
cin >> b[i].first >> b[i].second;
d.insert(b[i].first);
d.insert(b[i].second);
}
for (int i = 0; i < a; i++) cin >> c[i].first >> c[i].second;
vector<int> e(d.begin(), d.end());
auto f = [](vector<pair<int,int>> g) {
for (auto& [h, i] : g) if (h > i) swap(h, i);
sort(g.begin(), g.end());
return g;
};
auto j = [](const vector<pair<int,int>>& k) {
string l;
for (auto [m, n] : k) l += to_string(m) + "-" + to_string(n) + ",";
return l;
};
vector<pair<int,int>> o = f(c);
string p = j(o);
vector<pair<int,int>> q = f(b);
string r = j(q);
if (r == p) {
cout << 0;
return 0;
}
map<string,int> s;
queue<pair<vector<pair<int,int>>,int>> t;
t.push({q,0});
s[r] = 0;
while (!t.empty()) {
auto [u,v] = t.front();
t.pop();
map<int,vector<int>> w;
for (auto [x,y] : u) {
w[x].push_back(y);
w[y].push_back(x);
}
set<vector<int>> z;
for (int aa : e) {
function<void(int,int,vector<int>&,set<int>&)> ab = [&](int ac,int ad,vector<int>& ae,set<int>& af) {
ae.push_back(ac);
af.insert(ac);
for (int ag : w[ac]) {
if (ag == ad) continue;
if (af.count(ag)) {
auto ah = find(ae.begin(), ae.end(), ag);
if (ah != ae.end()) {
vector<int> ai(ah, ae.end());
if (ai.size() >= 3) {
int aj = min_element(ai.begin(), ai.end()) - ai.begin();
rotate(ai.begin(), ai.begin() + aj, ai.end());
z.insert(ai);
}
}
} else if (ae.size() < e.size()) ab(ag, ac, ae, af);
}
ae.pop_back();
af.erase(ac);
};
vector<int> ak;
set<int> al;
ab(aa, -1, ak, al);
}
for (const auto& am : z) {
map<int,int> an;
for (int ao : e) an[ao] = ao;
int ap = am.size();
for (int aq = 0; aq < ap; aq++) an[am[aq]] = am[(aq + 1) % ap];
vector<pair<int,int>> ar;
for (auto [as, at] : u) ar.push_back({an[as], an[at]});
ar = f(ar);
string au = j(ar);
if (au == p) {
cout << v + 1;
return 0;
}
if (!s.count(au)) {
s[au] = v + 1;
t.push({ar, v + 1});
}
}
}
cout << -1;
return 0;
}
Zoobin β @Mrtrueliving_ix
π¨ Infosys SE - ONCAMPUS Slots Open! π¨
π» Access from Computer Lab
π― For those aiming for 100% Test Clearance
β Book your slots now!
@Mrtrueliving_ix @Mrtrueliving_ix
π° Note:
If access to the Computer Lab is not provided, then 75% of the amount will be refunded.
Placement exams Help available....
=> Accenture - ONCAMPUS { π― Success}
=> Infosys - ONCAMPUS
=> Infosys edgeverve
=> Epam
=> IBM - offline - coding
=> Wayfair
=> Adobe
=> Eurofins
=> Hcl Offcampus - R2
Those who need π― test Clearance
DM @Mrtrueliving_ix @Mrtrueliving_ix
Test Clearance Guarantee π
π Check the pinned message π to see success stories & proofs of our past placement assistance π―π
π2
Company: IBM
Role : Associate System Engineer
{ CIC HIRING}
Batch : 2025
Apply link ποΈ
https://ibmglobal.avature.net/en_US/careers/JobDetail/Associate-System-Engineer/66789
Role : Associate System Engineer
{ CIC HIRING}
Batch : 2025
Apply link ποΈ
https://ibmglobal.avature.net/en_US/careers/JobDetail/Associate-System-Engineer/66789
Infosys edgeverve Help Available π―
@Mrtrueliving_ix @Mrtrueliving_ix
Only plagfree codingβ
Previous helping proofs
https://t.me/Code_alphix/6752?single
https://t.me/Code_alphix/6753
@Mrtrueliving_ix @Mrtrueliving_ix
Only plagfree codingβ
Previous helping proofs
https://t.me/Code_alphix/6752?single
https://t.me/Code_alphix/6753
https://t.me/Code_alphix/6777
Edgeverve codes are available
@Mrtrueliving_ix @Mrtrueliving_ix
suffixQueriesβ
Playing with arrays β
@Mrtrueliving_ix @Mrtrueliving_ix
def check(A):
return sum(A) * len(A)
def main():
n = int(input())
A = [int(input()) for _ in range(n)]
print(check(A))
if __name__ == "__main__":
main()
Playing with arrays β
β€1
import sys
import bisect
def suffixQueries(S, query):
suffixes = [S[i:] for i in range(len(S))]
suffixes.sort()
total = 0
for q in query:
i = bisect.bisect_left(suffixes, q)
if i < len(suffixes) and suffixes[i].startswith(q):
total += len(suffixes[i])
else:
total += 0
return total % (10**9 + 7)
def main():
N = int(sys.stdin.readline().strip())
Q = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()
query = [sys.stdin.readline().strip() for _ in range(Q)]
ans = suffixQueries(S, query)
print(ans)
if __name__ == "__main__":
main()
Suffixquiress β
Epam Slots are available
@Mrtrueliving_ix @Mrtrueliving_ix
Review:
https://t.me/Code_alphix/8410?single
Those who need Test Clearance π―
Successfully cleared Virtusa Hackthon β
Shortlist for Technical interview ππ»
Test accomplished β€οΈ || with π― success Rate
R2:https://t.me/Code_alphix/8407?single
@Mrtrueliving_ix @Mrtrueliving_ix
#Virtusa #Hackthon #Interview #SDE
Shortlist for Technical interview ππ»
Role : software developer Engineer
Test accomplished β€οΈ || with π― success Rate
R2:https://t.me/Code_alphix/8407?single
DM for any placement Help available
@Mrtrueliving_ix @Mrtrueliving_ix
#Virtusa #Hackthon #Interview #SDE
β€3
β οΈ Donβt Waste Your Time & Money on the Wrong People! π‘
These days, many claim to help β but not everyone truly wants to see you grow.
Some only care about payment, while real mentors care about your progress and success.
π― Choose wisely!
Find mentors who guide you with honesty, support you with patience,
and push you toward your goals with real dedication.
πͺ The right guidance can change your career.
The wrong one can cost you both your time and your confidence.
β¨ Invest in people who invest in you.
Because when you learn from the right hands β success is guaranteed! π
β€οΈ Yours truly β @Mrtrueliving_ix & His Team π»
ultimate success is guaranteed! π
#ChooseWisely #TrueGuidance #SmartLearning #TeamTrueLiving #SuccessWithPurpose
β€1
π Company : ShareChat
Role : SDE Intern
Eligible Batches : 2025, 2026 Graduates
Stipend : βΉ50K per month
Location : Bangalore
Duration : 6 Months
πApply Link :
https://www.linkedin.com/jobs/view/4333740347
Role : SDE Intern
Eligible Batches : 2025, 2026 Graduates
Stipend : βΉ50K per month
Location : Bangalore
Duration : 6 Months
πApply Link :
https://www.linkedin.com/jobs/view/4333740347
Test mail confirm
Linkedin
ShareChat hiring SDE-Intern in Bengaluru, Karnataka, India | LinkedIn
Posted 12:52:11 PM. Who are we and What do we do?
ShareChat (https://sharechat.com/about) is India's largest Profitableβ¦See this and similar jobs on LinkedIn.
ShareChat (https://sharechat.com/about) is India's largest Profitableβ¦See this and similar jobs on LinkedIn.
β€2
*ππ₯ SoftSuave Software Tech OFF Campus Hiring 2025 β Freshers Only Active link Apply Now*
*π Role:* Software Developer (Freshers)
*π Eligibility:* B.E./B.Tech/M.E./M.Tech/MCA/BCA/B.Sc CS graduates of 2023, 2024 & 2025 with strong logical and analytical thinking
*π‘ Interview Process:*
β’ Level 1: Online MCQ
β’ Level 2 & 3: Programming Test
β’ Level 4: Technical Interview
*π° Salary:* βΉ25,000 β βΉ38,000 (Expected)
*β³ Last Date:* 7th Nov 2025
Apply link :-
https://www.naukri.com/job-listings-software-engineer-trainee-0-1y-fresher-java-python-soft-suave-chennai-0-to-1-years-021125002292?utmcampaign=androidjd&utmsource=share&src=sharedjd
*π Role:* Software Developer (Freshers)
*π Eligibility:* B.E./B.Tech/M.E./M.Tech/MCA/BCA/B.Sc CS graduates of 2023, 2024 & 2025 with strong logical and analytical thinking
*π‘ Interview Process:*
β’ Level 1: Online MCQ
β’ Level 2 & 3: Programming Test
β’ Level 4: Technical Interview
*π° Salary:* βΉ25,000 β βΉ38,000 (Expected)
*β³ Last Date:* 7th Nov 2025
Apply link :-
https://www.naukri.com/job-listings-software-engineer-trainee-0-1y-fresher-java-python-soft-suave-chennai-0-to-1-years-021125002292?utmcampaign=androidjd&utmsource=share&src=sharedjd
π§ Assessment Structure (6 Parts)
1οΈβ£ Verbal Reasoning β 15 Qs | 18 mins
2οΈβ£ Logical Reasoning β 15 Qs | 18 mins
3οΈβ£ Quantitative Aptitude β 15 Qs | 18 mins
4οΈβ£ Analytical Reasoning β 15 Qs | 18 mins
5οΈβ£ Critical Reasoning β 15 Qs | 18 mins
6οΈβ£ HackerRank (Coding Section)
β±οΈ The test will auto-submit once time ends.
1οΈβ£ Verbal Reasoning β 15 Qs | 18 mins
2οΈβ£ Logical Reasoning β 15 Qs | 18 mins
3οΈβ£ Quantitative Aptitude β 15 Qs | 18 mins
4οΈβ£ Analytical Reasoning β 15 Qs | 18 mins
5οΈβ£ Critical Reasoning β 15 Qs | 18 mins
6οΈβ£ HackerRank (Coding Section)
β±οΈ The test will auto-submit once time ends.
Hcl ONCAMPUS test pattern β
β€1