zero4338's blog

By zero4338, history, 2 years ago, In English

The code below outputs -8 in cf custom test when using any GNU compiler.
It should output 2 and works well on other online IDEs and my computer.
It also works well on cf when using Clang.
What's the reason for this and how to avoid it?

#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>f;
int mg(pair<int,int>x,pair<int,int>y)
{
	return max(x.second,y.second);
}
int main()
{
	f={{0,-11}};
	for(int J=0;J<=0;J++)
	{
		f[J]=f[0];
		if(J==0)f[J]={0,2};
 		cout<<mg({0,-8},f[J])<<endl;
	}
	return 0;
}

Full text and comments »

  • Vote: I like it
  • +109
  • Vote: I do not like it

By zero4338, history, 3 years ago, In English

I heard that it is possible to compute $$$\sum\limits_{i=1}^n\frac{1}{i}\pmod{998244353}$$$ in $$$O(\sqrt n)$$$ complexity with some polynomial technology .

But I don't know how. Can someone give a solution ?

Full text and comments »

  • Vote: I like it
  • +53
  • Vote: I do not like it