This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstring> | |
#include <cstdlib> | |
#include <algorithm> | |
using namespace std; | |
int a[1000005],n; | |
int b[1000005]; | |
int sol(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
#include <limits.h> | |
#include <stack> | |
#include <queue> | |
#include <map> | |
#include <set> | |
#include <algorithm> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <math.h> | |
#include <time.h> | |
#include <iostream> | |
#include <functional> | |
#include <numeric> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long lint; | |
typedef long double llf; | |
typedef pair<lint, lint> pi; | |
struct node{ | |
int max, snd, cnt; | |
lint sum; | |
}tree[2100000]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct sfxarray{ | |
int ord[MAXN], nord[MAXN], cnt[MAXN], aux[MAXN]; | |
void solve(int n, char *str, int *sfx, int *rev){ | |
int p = 1; | |
memset(ord, 0, sizeof(ord)); | |
for(int i=0; i<n; i++){ | |
sfx[i] = i; | |
ord[i] = str[i]; | |
} | |
int pnt = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long lint; | |
typedef long double llf; | |
typedef pair<int, int> pi; | |
int n; | |
lint basis[60]; | |
int main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long lint; | |
typedef pair<int, int> pi; | |
struct seg{ | |
int tree[270000], lim; | |
void init(int n){ | |
for(lim = 1; lim <= n; lim <<= 1); | |
} | |
void add(int x, int v){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef long long lint; | |
namespace fft{ | |
typedef complex<double> base; | |
void fft(vector<base> &v, bool inv){ | |
vector<base> w(v.size()); | |
for(int i=2; i<=v.size(); i<<=1){ | |
int bsz = v.size() / i; | |
base ang(cos(2 * M_PI / i), sin(2 * M_PI / i)); | |
if(inv) ang = base(1, 0) / ang; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long lint; | |
typedef pair<int, int> pi; | |
struct disj{ | |
int pa[2000005]; | |
void init(int n){ | |
for(int i=0; i<=n; i++) pa[i] = i; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long lint; | |
typedef pair<int, int> pi; | |
int cnt[10005], n; | |
int main(){ | |
cin >> n; | |
int sum = 0; |