1582
#include <iostream>
#include <map>
#include <vector>
void solve_problem() {
int n, x;
std::cin >> n >> x;
std::map<int, int> num_count;
std::vector<int> sequence(n);
for (int& num : sequence) {
std::cin >> num;
num_count[num]++;
}
int mex = 0;
while (true) {
if (num_count[mex] == 0) {
std::cout << mex << '\n';
break;
}
if (num_count[mex] > 1) {
num_count[mex + x] += num_count[mex] - 1;
}
mex++;
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int t = 1;
std::cin >> t;
while (t--) {
solve_problem();
}
return 0;
}
Correct B
it would fail in pre tests
Читать полностью…
Sour Candy ✅
Optum
Google Cloud is Hiring
0-2 YOE
https://www.google.com/about/careers/applications/jobs/results/113097906944123590
Juspay results are out
Читать полностью…
does anyone need tree or gcd?
Читать полностью…
bro i cant see it can u send it like copy paste it here
Читать полностью…
Triangle Count (Easy)
Читать полностью…
Code bhejdo koi please
Читать полностью…
can anyone hint me with gcd one
Читать полностью…
Calorie LIMIT CODECHEF
Читать полностью…
Har ke kesa lag raha he batau
Читать полностью…
Means codeforces is sending similar solutions attention
Читать полностью…
Bro how to escape skipped problems??
Читать полностью…
write full code please
Читать полностью…
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
int t;
cin >> t;
while (t--)
{
int n, m, q;
cin >> n >> m >> q;
int a[n];
vector<int> b;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < m; i++)
{
int x;
cin >> x;
if (b.empty() || b.size() > 0 && b.back() != x)
{
b.push_back(x);
}
}
m = b.size();
unordered_set<int> s;
int ans = 1;
int idx = 0;
for (int i = 0; i < m; i++)
{
if (b[i] == a[idx])
{
s.insert(a[idx]);
idx++;
}
else
{
auto it = s.find(b[i]);
if (it != s.end())
{
}
else
{
ans = 0;
break;
}
}
}
if (ans)
{
cout << "YA" << endl;
}
else
{
cout << "TIDAK" << endl;
}
}
}
C1 CODEFORCES SOLUTION
🔥CF 🔥
C1 DONE ✅
C1 DONE ✅ in text
DMM
@codercpp001
If you want solutions share group and subscribe❗️❗️❗️✅✅✅
Читать полностью…
Anyone got amazon Applied Scientist intern interview mail??
Читать полностью…
which one do u need bro
Читать полностью…
🔥CODECHEF 🔥
TRIANGLE COUNT EASY DONE. ✅ ✅✅✅
TREE CUT XOR.. ✅✅✅
TREE CUT XOR. DONE. ✅✅✅
TREE CUT XOR. ✅✅
DMM
@codercpp001
GCD XOR SOLUTION
SUBSCRIBE AND SHARE GROUP FOR MORE FREE CODES
🔥CODECHEF 🔥
TRIANGLE COUNT EASY DONE. ✅ ✅✅✅
TREE CUT XOR.. ✅✅✅
TREE CUT XOR. DONE. ✅✅✅
TREE CUT XOR. ✅✅
DMM
@codercpp001
yea same i aint getting it too
Читать полностью…
Gcd and xor bhej bhai
Читать полностью…
Harm blue dabudi dabuday and dabuti daputai daputi daputai
Читать полностью…
Anyone from Bangladesh?
Читать полностью…
Just change problems.
Читать полностью…
Has anybody given oa of fastenal??? Pls msg
Читать полностью…
B Just write first 1 and write from n , n - 1 , .... , 2
For example:
n = 5
Output : 1 5 4 3 2