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
import java.io.*; | |
import java.util.*; | |
import static java.lang.Integer.min; | |
public class Main { | |
public static void main(String[] args) throws FileNotFoundException { |
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
class segtree | |
{ | |
private: | |
int sz; | |
vector<map<ll, int > > tr; | |
inline void add(map<ll, int >& d, const map<ll, int>& from) | |
{ | |
for(auto& p: from) | |
d[p.F] += p.S; |
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
class fenwick | |
{ | |
public: | |
fenwick(); | |
fenwick(fenwick& x); | |
const fenwick& operator=(const fenwick& t); | |
const fenwick& operator=(const fenwick& t) const; | |
fenwick(int sz) : tr(sz, 0), sz(sz) {} |
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
template<typename T> | |
const char32_t * const __get_byte_array(const T& data) | |
{ | |
void * __void_ptr = (void *) &data; | |
const char32_t * const __char_ptr = (const char32_t * const) __void_ptr; | |
return __char_ptr; | |
} | |
template<typename T> |
This file has been truncated, but you can view the full file.
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
50000 150000 | |
1 2 | |
2 3 | |
3 4 | |
4 5 | |
5 6 | |
6 7 | |
7 8 | |
8 9 | |
9 10 |
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
var a,r:array of array of array of longint;k,r1,r2:array [1..50000] of longint; | |
p:array [1..5000] of boolean; | |
n,m,i,j,x,y,s,f,k1:longint; | |
procedure dfs(v:longint); | |
begin | |
p[v]:=false; | |
for j:=1 to k[v] do | |
if (p[j]=true) and (r[v,j]=0) then | |
begin | |
dfs(a[v,j]); |
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
ll memeficate(ll r) | |
{ | |
ll x = 0; | |
for(int i = 1; i < 62; i += 2) | |
x |= bool((r & (1ll << i))) << (i >> 1); | |
return x; | |
} | |
ll cnt(ll r) |
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> | |
//#include <ext/pb_ds/assoc_container.hpp> | |
//#include <ext/pb_ds/tree_policy.hpp> | |
using namespace std; | |
//using namespace __gnu_pbds; | |
#define INF (1<<30) |
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> | |
//#include <ext/pb_ds/assoc_container.hpp> | |
//#include <ext/pb_ds/tree_policy.hpp> | |
using namespace std; | |
//using namespace __gnu_pbds; | |
#define INF (1<<30) |
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> | |
//#include <ext/pb_ds/assoc_container.hpp> | |
//#include <ext/pb_ds/tree_policy.hpp> | |
using namespace std; | |
//using namespace __gnu_pbds; | |
#define INF (1<<30) |