codesolvediscuss | Unsorted

Telegram-канал codesolvediscuss - Codeforces solutions | CodeSolve | discussion

1582

Subscribe to a channel

Codeforces solutions | CodeSolve | discussion

Anyone have alt 1400+ on CF? If have please DM me.

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Does anyone has a hack for A or B?

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Fcking losers lmao..cheating karke lund kuch nhi ho rha tumhara...bas shortcut dhundte rahoge bhadwon...mehnat koi nhi karna chahta...

Читать полностью…

Codeforces solutions | CodeSolve | discussion

i can give my code is working

Читать полностью…

Codeforces solutions | CodeSolve | discussion

All solutions up to 'f' are just inexpensive copy-paste dm if you want

Читать полностью…

Codeforces solutions | CodeSolve | discussion

#include <bits/stdc++.h>
#define pb push_back
#include <vector>
#include <set>
#include <map>
using namespace std;
#define ll long long
#define cpsolve_yes cout << "YES"
#define cpsolve_no cout << "NO"
#define cpsolve_nl "\n"
#define cpsolve_loop(i, n) for (int cpsolve_i = 0; cpsolve_i < (int)n; cpsolve_i++)
#define cpsolve_loop1(i, n) for (int cpsolve_i = 1; cpsolve_i <= (int)n; cpsolve_i++)
#define cpsolve_loopab(i, a, b) for (int cpsolve_i = (int)a; cpsolve_i <= (int)b; cpsolve_i++)
#define cpsolve_all(a) (a).begin(), (a).end()
ll cpsolve_MOD = 1e9 + 7;
//(a-b)%m=(a%m-b%m+m)%m
// DIV BY MOD  (multiplicative in of b)=pw(b,m-2)%m;
ll cpsolve_pw(ll cpsolve_a, ll cpsolve_b)
{
  if (cpsolve_b == 0)
    return 1;
  ll cpsolve_t = cpsolve_pw(cpsolve_a, cpsolve_b / 2);
  if (cpsolve_b % 2 == 0)
    return 1ll * cpsolve_t * cpsolve_t % cpsolve_MOD;
  else
    return 1ll * cpsolve_t * cpsolve_t * cpsolve_a % cpsolve_MOD;
}

int cpsolve_findKthMissingPositive(std::vector<ll> &cpsolve_arr, ll cpsolve_k)
{
  // If the first element in the array is greater than cpsolve_k, the cpsolve_kth missing
  // number must be cpsolve_k itself.
  if (cpsolve_arr[0] > cpsolve_k)
  {
    return cpsolve_k;
  }

  int cpsolve_left = 0;
  int cpsolve_right = cpsolve_arr.size();

  while (cpsolve_left < cpsolve_right)
  {
    int cpsolve_mid = cpsolve_left + (cpsolve_right - cpsolve_left) / 2;

    if (cpsolve_arr[cpsolve_mid] - cpsolve_mid - 1 >= cpsolve_k)
    {
      cpsolve_right = cpsolve_mid;
    }
    else
    {
      cpsolve_left = cpsolve_mid + 1;
    }
  }

  return cpsolve_arr[cpsolve_left - 1] + cpsolve_k - (cpsolve_arr[cpsolve_left - 1] - (cpsolve_left - 1) - 1);
}

void cpsolve_solve()
{
  ll cpsolve_n, cpsolve_k;
  cin >> cpsolve_n >> cpsolve_k;
  vector<ll> cpsolve_a(cpsolve_n);
  cpsolve_loop(cpsolve_i, cpsolve_n) cin >> cpsolve_a[cpsolve_i];
  sort(cpsolve_a.begin(), cpsolve_a.end(), greater<ll>());
  if (cpsolve_a[0] == 0)
  {
    cout << cpsolve_k << cpsolve_nl;
    return;
  }
  if (cpsolve_n == 1)
  {
    cout << cpsolve_findKthMissingPositive(cpsolve_a, cpsolve_k - 1) << cpsolve_nl;
    return;
  }
  ll cpsolve_gc = cpsolve_a[0];
  cpsolve_loop(cpsolve_i, cpsolve_n)
  {
    cpsolve_gc = __gcd(cpsolve_gc, cpsolve_a[cpsolve_i]);
  }
  // cout << cpsolve_gc << cpsolve_nl;
  ll cpsolve_im = 0;
  cpsolve_loop(cpsolve_i, cpsolve_n)
  {
    cpsolve_a[cpsolve_i] = cpsolve_im * cpsolve_gc;

    cpsolve_im++;
  }
  ll cpsolve_ans = cpsolve_findKthMissingPositive(cpsolve_a, cpsolve_k - 1);
  cout << cpsolve_ans << cpsolve_nl;
}

int main()
{
  ll cpsolve_t = 1;
  cin >> cpsolve_t;
  while (cpsolve_t--)
  {
    cpsolve_solve();
  }
  return 0;
}

G solution

Читать полностью…

Codeforces solutions | CodeSolve | discussion

ill give u the rest if u give G

Читать полностью…

Codeforces solutions | CodeSolve | discussion

🔥🔥Code Forces Div3🔥🔥


G done ✅ ✅ ✅
G done ✅ ✅ ✅

G done ✅ ✅ ✅

dm me for Solution

Читать полностью…

Codeforces solutions | CodeSolve | discussion

this code one million percent will get caught for plagiarism, this is too long. don't think changing the variable names will help you.

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Very good solutionnn

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Yes I have submitted

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Anyone giving cisco oa??

Читать полностью…

Codeforces solutions | CodeSolve | discussion

#include <bits/stdc++.h>
using namespace std;
int main() {
int test_case;
cin >> test_case;
while(test_case-- > 0) {
int n, q;
cin >> n >> q;
vector<int>a(n);
for(int i = 0;i < n;i++) cin >> a[i];
vector<int>map(n+2);
for(int i = 0;i < n;i++) {
++map[a[i]];
}
vector<int>answer(n+2,-1);
while(q--) {
int x;
cin >> x;
if(answer[x] != -1) {
cout << answer[x] << ' ';
continue;
}
int count = 0;
for(int j = 0;j < x;j++) {
for(int i = j;i <= n;i += x) {
count += map[i];
}
if(count >= n / 2 + 1) {
answer[x] = j;
cout << j << ' ';
break;
}
}
}
cout << endl;
}
}

H solution✅

Читать полностью…

Codeforces solutions | CodeSolve | discussion

itis giving runtime error

Читать полностью…

Codeforces solutions | CodeSolve | discussion

Isn't this will fail in case of a=4 and b=5

Читать полностью…

Codeforces solutions | CodeSolve | discussion

All solutions up to 'f' are just inexpensive copy-paste

Читать полностью…

Codeforces solutions | CodeSolve | discussion

G nahi hua H kaise hoga

Читать полностью…

Codeforces solutions | CodeSolve | discussion

is there a way to copy and be sure to avoid plag?

Читать полностью…

Codeforces solutions | CodeSolve | discussion

One liner h bhai ye. 89sec me solve kra h

Читать полностью…

Codeforces solutions | CodeSolve | discussion

is it working anyone?

Читать полностью…

Codeforces solutions | CodeSolve | discussion

yes bro there is wrong code

Читать полностью…
Subscribe to a channel