Comments

Also worst weekend for getting brutally killed when problems are tough ..

On subodhk → Dynamic A2OJ is back!!!, 6 years ago
+1

Hi sir your ladders are not visible please fix the error I really liked the ladders

fuckoff @onlyone is this editorial or a Treasure hunting letter??.

+12

Ksun48 may you explain us the incident how you met ecnerwala, stevenkplus, scott_wu(harvard) in MIT . Share any great time/incident you had with all the three people.

-62

I think once you go back to MIT you will pay for it my dear friend... because ecnerwala knows all professor of MIT so the will give you less marks in semester exams..

https://atcoder.jp/contests/abc131/tasks/abc131_c

may anyone please explain the helper part of the functions .......

like (A-1) is used int helper functions???

include <bits/stdc++.h>

include <math.h>

using namespace std;

ll gcd(ll a, ll b)

{

return a % b == 0 ? b : gcd(b, a % b);

}

ll lcm(ll a, ll b)

{

return a * b / gcd(a, b);

}

// 1以上x以下の整数でcでもdでも割り切れないものの数を求める

ll helper(ll c, ll d, ll x)

{

return (x - (x / c + x / d - x / lcm(c, d)));

}

int main()

{

ll A, B, C, D;

cin >> A >> B >> C >> D;

cout << helper(C, D, B) - helper(C, D, A - 1) << endl;

return 0;

}

thx

0

...

https://codeforces.me/problemset/problem/366/B

may anyone plese explain what this problem means to say

https://www.youtube.com/watch?v=JrzIgYS3SqM

this will help

include <bits/stdc++.h>

include <string.h>

include

//s#define rep(i, n) for (int i = 0; i < (n); i++)

define MAX 10000

using namespace std;

define ll long long

define pb push_back

define mp make_pair

define all(a) (a).begin(),(a).end()

define rep(i,a,n) for(int i=a; i<n; i++)

define r0 return 0

define INF (int)1e15

define MOD 1000000007

int swaps(int a[],int n){

// int n = a.size(); pair<int,int>p[n];

for(int i=0;i<n;i++){ p[i].first = a[i]; p[i].second = i; }

sort(p,p+n); int ans = 0; bool visited[n] = {false};

for(int i=0;i<n;i++){ if(visited[i] == true || p[i].second == i) continue;

int cycle_size = 0;
  int j = i;

  while(!visited[j]){
        visited[j] = 1;
        j = p[j].second;
        cycle_size ++;
  }

  ans += (cycle_size-1);

}

return ans; }

int main(){

long long n; cin>>n; int a[n];

for(int i=0;i<n;i++) cin>>a[i];

int mini_swaps = swaps(a,n); cout<<mini_swaps<<endl;

return 0; }

0

..

+5

..

https://codeforces.me/contest/469/submission/7894252

may anyone explain the last two lines of the above code after using brute force for checking the overlapping time what is happening..

Does it even matter .???

,.

Toothbrush is new problem setter for ABC contest.. from now onwards..

On Clinking → To the Chinese People here, 6 years ago
-21

Hope everything gets well soon..

may anyone explain in simple word what is the debug code is and how to use the above code in program

thanks a lot in advance ...

Does the rating of the newbies changes if we take a virtual contest? if not then why are you are so concern @ Geothermal ..

if yes then it is problem .. by the way thanks for making blogs for Atcoder beginner contest solutions

On subodhk → Dynamic A2OJ is back!!!, 6 years ago
+3

..

please tell how what is the logic behind problem c of atcoder beginner contest ..

Q link
https://atcoder.jp/contests/abc127/tasks/abc127_c

answer link

https://atcoder.jp/contests/abc127/submissions/14653099

why are we finding the maximum and minimum value in the Q..

Is there a way to look for the topic tag in atcoder so that I becomes easy to code it down

anyone please help me out

may anyone explain me how is the minimum steps required to do it is a+b-2

and how are we getting aa and from 1. a*b = n equation

C: walk on multiplication table

The number of moves needed to reach (a, b) from (1, 1) is a + b − 2. Therefore, the problem can be rephrased as ”find the minimum value of a + b − 2 for all (a, b) such that a × b = N.” By symmetry you can assume that a ≤ b, so by performing brute-force searching for all a ≤ √ N, the problem can be solved in a total of O(√N) time.

but does it contains all the latest problem of atcoder

no such webite is visible to me

I tried running my code on ideone in default setting and someone copied my code and I was not aware about that. It will take care next time..

0

mayanyone tell me why is t = n+n-1 used the code

0

include

include

using namespace std;

int main() {

int n, h, h0(0);



scanf("%d", &n);







int time = n + n - 1;









while (n--)
{





    scanf("%d", &h);



    time += abs(h - h0);




    h0 = h;








}




printf("%d\n", time)





return 0

}

339B — Xenia and Ringroad

To solve this problem we must learn how to calculate fast enought the time, needed to travel between houses a and b. Let's consider the case when a ≤ b. Than Xenia needs b - a seconds to get from a to b. Otherwise a > b, Xenia will have to go thought house number 1. So she will need n - a + b seconds.

may one explain me a and b here means house or seconds if seconds

then i am ok with case if(a<b) b-a

but how is the n-a+b case is not able to get it

as he needs to go till the first house and then travel to the final destination

so (intial_postion — 1) + (final_postion-1) should i knows I am really getting fed up with it past new month please plese help me out.........

you look cute just a compliment

include

include

include

using namespace std;

int a[1006];

int main(void) { int n, l; cin>>n>>l;

for(int i= 0; i<n; i++){
    cin>>a[i];
}

double mx= 0, temp;
sort(a, a+n);

for(int i= 1; i<n; i++){
    temp= abs(a[i]-a[i-1]);

    if(mx < temp) mx= temp;
}

mx = (double)mx/2;

// may one explain why are we doing finding the maximum value of the (a[0],max) and max(a[n-1],mx) in the problem .... //

mx= fmax(mx, a[0]);
mx= fmax(mx, abs(a[n-1] - l) );


cout<<fixed;
cout.precision(9);
cout<< mx <<endl;
return 0;

}

thxx a lot

why in the hell the editorial are not available

https://codeforces.me/contest/1283/problem/C

how to add the elements that are not present in the array in the places where Zeroes are present.. anyone please help

include <bits/stdc++.h>

include

include <string.h>

include <math.h>

using namespace std;

int main() {

int n,x;

cin>>n;

vectorv;

vectora;

vectorv3;

for(int i=0;i<n;i++){

cin>>x;

if(x!=0) a.push_back(x);

v.push_back(x);

}

//int ans[3] = {2,4,5};

for(int j=1;j<=n;j++){

int flag = 1;

for(int i=0;i<3;i++){

cout<<j<<" "<<a[i]<<endl;

if(j == a[i]){

flag = 0;

  break; }

}

if(flag == 1){

 cout<<"mc"<<endl;

 v3.push_back(j); }

}

for(int i=0;i<v.size();i++){

if(v[i] == 0 && v3[i] != i){

v[i] = v3[i];

}

}

for(int i=0;i<v.size();i++){

cout<<v[i]<<"  ";

}

return 0; }

Red coder shubham sir please help .

What did you mean by HML-BKL well kindly requested to give some usefully suggestions

How to increase my fucking rating.. Really frustrating.. Anyone please help.

god...of coding

got it thx

include <bits/stdc++.h>

include

using namespace std;

int main() {

freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

int x,k,i,a,b; while(cin>>x){

k = x;
for(int i=0;i<3;i++){
   cin>>a>>b;

  if(k == a)
  k = b;
else if(k == b)
k = a;  }

 cout<<k<<endl;

}

return 0; }

help me out anyone with helpful resources

include <stdio.h>

include <stdlib.h>

int main()

{

FILE *wrp;

int n;

char data[100];

char num[5];

wrp = fopen("input.txt","r");

char readchar;

int i=0;

int jl = 0;

int x=0;

while (1==1) {

readchar = fgetc(wrp);

if (readchar == EOF) {

    break;

}

if (readchar != '\n') {

if (x==0) {

num[jl] = readchar;

jl++;

} else {

data[i] = readchar;
i++;

}

} else { x=1; } }

fclose(wrp);

n = atoi(num);

wrp = fopen("output.txt","w");

int j=0;

while(j<n/2) {

if (data[j] == 'L') {

char num1[3];

char num2[3];

itoa(j+1,num1,10);

itoa(j+(n/2)+1,num2,10);

fputs(num1,wrp);

fputs(" ",wrp);

fputs(num2,wrp);

fputs("\n",wrp);

} else {

if (data[j+(n/2)] == 'L') {

char num1[3];

char num2[3];

itoa(j+1,num1,10);

itoa(j+(n/2)+1,num2,10);

fputs(num2,wrp);

fputs(" ",wrp);

fputs(num1,wrp);

fputs("\n",wrp);

} else {

char num1[3];

char num2[3];

itoa(j+1,num1,10);

itoa(j+(n/2)+1,num2,10);

fputs(num1,wrp);

fputs(" ",wrp);

fputs(num2,wrp);

fputs("\n",wrp);

}

}

j++;

}

fclose(wrp);

return 0;

}

sir in this contest also we are reading and writing in file i am beginner not able to understand how to write opening files in ICPC contest please help me out

wrp = fopen("output.txt","r");

wrp = fopen("output.txt","w");

.

sir said that we dont read any file then what is this sir

freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

ya

0

ask ahmed sir i too need it..

On vfleaking → Codeforces Round #250, 7 years ago
0

exactly