Codeforces|Leetcode|Codechef free solutions
الذهاب إلى القناة على 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.
إظهار المزيد4 317
المشتركون
لا توجد بيانات24 ساعات
-137 أيام
-5230 أيام
أرشيف المشاركات
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int t = 1;
cin >> t;
while (t--)
{
int num;
cin >> num;
if (num % 2)
cout << num-- << ' ';
for (int i = 1; i <= num / 2; i++)
cout << num - i + 1 << ' ' << i << ' ';
cout << endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
while (T--) {
int N, M;
cin >> N >> M;
vector<int> A(N);
vector<int> B(N);
for (int i = 0; i < N; i++) cin >> A[i];
for (int i = 0; i < N; i++) cin >> B[i];
unordered_map<int, int> candyRemainders;
unordered_map<int, int> chocolateRemainders;
for (int i = 0; i < N; i++) {
candyRemainders[A[i] % M]++;
chocolateRemainders[B[i] % M]++;
}
int cnt = 0;
for (const auto& [candyRem, candyCount] : candyRemainders) {
int requiredRemainder = (M - candyRem) % M;
if (chocolateRemainders.count(requiredRemainder)) {
cnt += candyCount * chocolateRemainders[requiredRemainder];
}
}
cout << cnt << endl;
}
return 0;
} what's wrong failing in last test case
After 5100+ subscribers I will post split permutation in group.
After seeing our channel many other telegram channels are providing free solutions, it's nice seeing them 😊😊
