Source stringclasses 1
value | Date int64 2.01k 2.02k | Text stringlengths 22 783k | Token_count int64 20 394k |
|---|---|---|---|
Project_CodeNet | 2,020 | #pragma 03
#pragma GCC target("avx")
#pragma GCC optimization ("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int long long
#define eb emplace_back
#define ef emplace_front
#define rep(i, x, n) for (int i = x; i < n... | 913 |
Project_CodeNet | 2,017 | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <cstdlib>
#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back
using namespace std;
const int N = 100010;
int n, k;
int L[N], R... | 500 |
Project_CodeNet | 2,019 | #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <deque>
#include <stack>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD_CONST ... | 2,128 |
Project_CodeNet | 2,020 | #pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);c... | 1,500 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int i=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
template <class T> ostream& operator<<(ostream& os, const... | 726 |
Project_CodeNet | 2,016 | #include<bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
typedef long long LL;
struct edge{
int to;LL cost;
bool operator<(const edge& o)const {return cost < o.cost... | 605 |
Project_CodeNet | 2,016 | //*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define M... | 482 |
Project_CodeNet | 2,019 | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll ... | 826 |
Project_CodeNet | 2,020 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedS... | 1,412 |
Project_CodeNet | 2,017 | #include<bits/stdc++.h>
using namespace std;
int l[300010],r[300010],col[300010];
vector<int> des[300010];
void dfs1(int s,int pre)
{
for (int k=0;k<des[s].size();k++) if (des[s][k]!=pre)
{
dfs1(des[s][k],s);
l[s]=max(l[s],l[des[s][k]]-1);
r[s]=min(r[s],r[des[s][k]]+1);
if (l[s]>r[s]) {puts("No");exit(0);}
}... | 446 |
Project_CodeNet | 2,019 | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
int n,lim_l[N],lim_r[N],ans[N];
bool dif;
namespace utils{
template <class T> inline void apx(T &x,const T y){
x<y?x=y:0;
}
template <class T> inline void apn(T &x,const T y){
x>y?x=y:0;
}
in... | 822 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int... | 738 |
Project_CodeNet | 2,020 | #include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
... | 1,086 |
Project_CodeNet | 2,016 | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef ... | 661 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
constexpr int DEBUG = 0;
struct Edge {
const int from, to;
Edge(int from, int to) : from(from), to(to) {}
};
vector<vector<Edge>> ReadUndirectedGraph(
int n, int m, bool is_one_indexed=false) {
vector<vector<Edge>> graph(n);
for (int... | 934 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;
vector<int> neig[100001];
int p[100001], l[100001], r[100001];
bool flag = 1;
pi fun(int u, int prev, pi p1)
{
pi p2 = {p1.first -... | 785 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define reps(i,... | 492 |
Project_CodeNet | 2,017 | #include<bits/stdc++.h>
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double llf;
typedef std::pair<int,int> pii;
#define xx first
#define yy second
template<typename T> inline T max(T a,T b){return a>b?a:b;}
template<typename T> inline T min(T a,T b... | 1,749 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,... | 834 |
Project_CodeNet | 2,019 | #include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> P;
int n, k, INIT=1e8;
P p[100000];
vector<int> e[100000];
P f(int x, int y, int z){
int a=-1e7, b=1e7, q=z;
if(p[x].first<INIT){
a=max(a, p[x].first);
b=min(b, p[x].second);
}
if(q==-1){
q=a%2;
... | 585 |
Project_CodeNet | 2,017 | #include<bits/stdc++.h>
const int inf=1e9+7;
const int N=100010;
using namespace std;
int val[N],lx[N],rx[N],pos[N],vis[N],isodd[N];
int tot,n,k,head[N];
struct Edge{int u,v,next;}G[N<<1];
inline int read(){
int f=1,x=0;char ch;
do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do{x=x*10+ch-'0';ch=getchar();}w... | 574 |
Project_CodeNet | 2,019 | #include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1... | 964 |
Project_CodeNet | 2,019 | #include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = ... | 777 |
Project_CodeNet | 2,016 | #include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<string>
#include<cmath>
using namespace std;
#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep... | 535 |
Project_CodeNet | 2,020 | #pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pa... | 857 |
Project_CodeNet | 2,020 | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#d... | 690 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=1e9;
int n,k;
vector<int>g[maxn];
int w[maxn];
int vis[maxn];
int flag;
int l[maxn],r[maxn];
void dfs(int x,int f)
{
// if(flag)return ;
if(!vis[x])
{
l[x]=-inf;
r[x]=inf;
}
for(int i=0; i<(int)g[x].size(); i++)
{
int to=g[x][... | 557 |
Project_CodeNet | 2,017 | #include <cstdio>
#include <algorithm>
#include <cstring>
#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)
using namespace std;
const int N = 100010;
st... | 709 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
using ll = long long;
using P = std::tuple<int,int>;
const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
const int INF = numeric_limits<int>::max() ... | 875 |
Project_CodeNet | 2,018 | #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <queue>
#define rg register
using namespace std;
typedef long long ll;
const int maxn=1000010;
template <typename Tp> inline int getmin(Tp &x,Tp y){return y<x?x=y,1:0;}
template <typename Tp> inline int getmax(Tp &x,Tp y){return y>x?x=y,1:0;}
template <ty... | 612 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
using namespace std;
#define N 110000
const int inf=1e9;
int n,tot,m,cnt,top;
int head[N],nex[N<<1],to[N<<1];
int fa[N][21],deep[N];
int val[N],L[N],R[N],pos[N],a[N],st[N],sig[N];
vector<int>vec[N];
void quit(){puts("No");exit(0);}
void add(int x,int y)
{
tot++;
nex[tot]=head[x];head[x]=tot;
... | 1,038 |
Project_CodeNet | 2,017 | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
const int maxm=2e5+10;
int n,k,L[maxn],R[maxn];
int c0,c1,dep[maxn],fa[maxn];
int tote,TO[maxm],NEXT[maxm],FIR[maxn];
void addedge(int u,int v)
{
TO[++tote]=v;
NEXT[tote]=FIR[u];
FIR[u]=tote;
}
void prework(int u)
{
dep[u]=dep[fa[u]]+1;
for (i... | 657 |
Project_CodeNet | 2,017 | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>
#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define N... | 546 |
Project_CodeNet | 2,016 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;
int n, m;
vector<int> E[MAXN];
int l[MAXN], r[MAXN], op[MAXN];
int f[MAXN];
const int inf = 1e8;
void read(){
scanf("%d", &n);
for(int i = 1... | 867 |
Project_CodeNet | 2,017 | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
const int MAXN = 100000 + 1000;
int n, m;
vector<int> edg[MAXN];
int col[MAXN], spe[MAXN], val[MAXN];
int L[MAXN], R[MAXN];
void ... | 736 |
Project_CodeNet | 2,019 | #include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
typedef long long ll;
#define MIN(... | 1,149 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y... | 771 |
Project_CodeNet | 2,020 | /*
* じょえチャンネル
* 高評価・チャンネル登録よろしくおねがいします!
* https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#includ... | 4,009 |
Project_CodeNet | 2,020 | //雪花飄飄北風嘯嘯
//天地一片蒼茫
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se seco... | 530 |
Project_CodeNet | 2,016 | #include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#define DIV 1000000007
using namespace std;
vector<long long> t... | 846 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define int long long
typedef long long ll;
using namespace std;
const ll MAX = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;
const double PI=3.1415926535897932;
ll N, K, ans=0, tmp=0;
vector<ll> P;
vector<pair<ll,ll>> PS;
vector<vector<pair<ll,ll>>> G;
set<ll> ST;
string S;
... | 561 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
const int N=100005;
int Head[N],Next[N<<1],Adj[N<<1],tot=0;
inline void addedge(int u,int v){
Next[++tot]=Head[u],Head[u]=tot,Adj[tot]=v;
Next[++tot]=Head[v],Head[v]=tot,Adj[tot]=u;
}
int L[N],R[N];
bool flag,p[N];
inline void check(int x,int f,bool t){
p[x]=t;
if (L[x]... | 641 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target ("avx")
#pragma GCC target ("avx2")
#pragma GCC target ("fma")
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld lon... | 1,017 |
Project_CodeNet | 2,018 | /*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define... | 885 |
Project_CodeNet | 2,017 | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using... | 613 |
Project_CodeNet | 2,018 | #include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;
#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a;... | 538 |
Project_CodeNet | 2,018 | #include <bits/stdc++.h>
#define N 100005
using namespace std;
int INF = 1e9;
typedef pair<int,int> ii;
vector<int> AdjList[N];
priority_queue<ii,vector<ii>,greater<ii>> pq;
signed main()
{
int n;
cin>>n;
int ans[n+1];
for(int i=1;i<=n;i++)
ans[i] = INF;
for(int i=1;i<n;i++)
{
... | 322 |
Project_CodeNet | 2,017 | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <assert.h>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define F first
#define S second
#define qq queue
#define dq deque
#define vc vector
#define INF ((int)(2... | 1,419 |
Project_CodeNet | 2,016 | #include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
using namespace std;
const int MAXN = 100005;
const int INF = 2000000000;
int numEdge, n, k;
int head[MAXN], id[MAXN];
int L[MAXN], R[MAXN];
struct Edge
{
int v, next;
}edge[MAXN << 1];
void addEdge(int u, int v)
{
edge[numEdge].v =... | 1,006 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;
int N, A, B, K, V, P, u... | 569 |
Project_CodeNet | 2,017 | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <assert.h>
#define N 1000010
using namespace std;
int n, k;
const int INF[2] = {20000000, 20000001};
vector<int> edge[N];
bool vis[N];
int val[N];
int up[N], down[N];
bool dfs(int u, int fa, bool odd) {
up[u] = ... | 720 |
Project_CodeNet | 2,018 | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=100005;
const int inf=1000000000;
int n,val[N],l[N],r[N],dep[N],last[N],cnt;
bool vis[N],flag;
struct edge{int to,next;}e[N*2];
int read()
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>... | 654 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
//main
signed main(){
int N;cin>>N;
std::vector<int> edge[N];
for(int i=1;i<N;i++){
int u... | 477 |
Project_CodeNet | 2,016 | // {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define... | 1,285 |
Project_CodeNet | 2,016 | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <complex>
#include <cassert>
#define enp puts("**ch... | 577 |
Project_CodeNet | 2,017 | #include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#inc... | 719 |
Project_CodeNet | 2,020 | /**
* author: otera
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bi... | 1,099 |
Project_CodeNet | 2,019 | #pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unorde... | 841 |
Project_CodeNet | 2,019 | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<unordered_map>
using namespace std;
typedef pair<long long int, long long int> P;
long long int INF = 1e18;
long long int MOD = 1e9 + 7;
vector<int> E[110000];
long long int val[110000];
P lim[110000];
P check1(int pos, i... | 626 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(au... | 885 |
Project_CodeNet | 2,016 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i... | 779 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn=1e5+5;
vector<int> G[maxn],order;
int n,a,b,known[maxn],val[maxn],l[maxn],r[maxn],k,used[maxn],known_parity[maxn][2],shit,par[maxn],ans[maxn];
void dfs(int v)
{
used[v]=1;
l[v]=-1e9;
r[v]=1e9;
for (int i=0;i<G[v].size();i++)
{
int t... | 585 |
Project_CodeNet | 2,020 | //#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>
#define ll long long
... | 1,460 |
Project_CodeNet | 2,017 | #include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define RG register
#define il inline
#define iter iterator
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std;
typedef long long ll;
const int N=100005;
int n,a[N],he... | 609 |
Project_CodeNet | 2,019 | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <queue>
using namespace std;
int main(){
const int INF = 10000000;
int N;
cin >> N;
vector<vector<int>> E(N);
vector<int> cnt(N, 0);
int a, b;
for(... | 1,009 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
#define len(x) (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b) for (int a = 0; a < int(b); ++a)
#define kk(n) ff(k, n)
#define xx(n) ff(x, n)
#define yy(n) ff(y, n)
#define ii(n) ff(i, n)
#define fff(a, b, c) for (int a = in... | 999 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)
using namespace std;
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;
template <typename T>
inline T gi()
{
... | 553 |
Project_CodeNet | 2,018 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define INF 0x7f7f7f7f
using namespace std;
int n,K,cnt,w[101010],l[101010],r[101010];
int nxt[202020],to[202020],fir[101010];
int d[100010];
void add(int x,int y)
{
nxt[++cnt]=fir[x];fir[x]=cnt;
to[cnt]=y;
}
void print()
{
puts("No");
exit(0... | 589 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
using namespace std;
template <typename X, typename T>
auto vectors(X x, T a) {
return vector<T>(x, a);
}... | 711 |
Project_CodeNet | 2,017 | /*** Template Begin ***/
#define USING_BOOST
#define USING_NAMESPACE
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#includ... | 2,028 |
Project_CodeNet | 2,016 | #pragma comment(linker, "/STACK:102400000,102400000")
#include<bits/stdc++.h>
#include<climits>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT f... | 869 |
Project_CodeNet | 2,016 | #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>... | 1,186 |
Project_CodeNet | 2,018 | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010;
int tt;
bool w[N];
int head[N],to[N*2],nxt[N*2],L[N],R[N],a[N];
inline int gi() {
int x=0,o=1;
char ch=getchar();
while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
if(ch==... | 565 |
Project_CodeNet | 2,018 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.tx... | 885 |
Project_CodeNet | 2,018 | /*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
const int MAXN=int(1e5),INF=int(1e9);
vector<int> lnk[MAXN+5];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > que;
int ans[MAXN+5];
int n,m;
int mai... | 338 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
int q=0,w=1;char ch=' ';
while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
if(ch=='-') w=-1,ch=getchar();
while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
return q*w;
}
const int N=100005,inf=0x3f3f3f3f;
int n,tot,K,rt;
int h[N],ne[N... | 607 |
Project_CodeNet | 2,018 | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define INF 1000000000
int n,k;
int x[100005],y[100005],ans[100005];
vector<int>g[100005];
bool o=true;
void dfs(int v,int p){
for(int i=0;i<g[v].size();i++){
int u=g[v][i];
if(u!=p){
dfs(u,v);
if... | 459 |
Project_CodeNet | 2,016 | #include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push... | 855 |
Project_CodeNet | 2,019 | // luogu-judger-enable-o2
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define inf 0x7FFFFFFF
#define N 110000
using namespace std;
vector<int>a[N];
int l1[N],r1[N],l2[N],r2[N],val[N],n,u,v,k;
bool dfs1(int u,int fa){
// printf("%d %d:\n",u,fa);
l1[u]=-inf;r1[u]=inf;
if(val[u]!=-inf) l1... | 696 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(W,n)cerr << v[W] << ' ';cerr << endl << endl;... | 650 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( uniqu... | 739 |
Project_CodeNet | 2,019 | /*input
5
1 2
2 3
2 4
4 5
3
3 1
5 4
1 1
*/
#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 int long long
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back... | 1,139 |
Project_CodeNet | 2,018 | /*************************************************
*************************************************
*************************************************
*** _________________ | | | /***
*** | | | | / ***
*** | | | | / ***
*** |... | 1,747 |
Project_CodeNet | 2,017 | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
struct node { int t,next; }a[200010];
int head[100010],num[100010],l[100010],r[100010],n,m,rt,tot;
bool flag;
inline int rd()
{
int x=0,f=1;char ch=getchar();
for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
for (;... | 612 |
Project_CodeNet | 2,019 | // warm heart, wagging tail,and a smile just for you!
// ███████████
// ███╬╬╬╬╬╬╬╬╬╬███
// ███╬╬╬╬╬████╬╬╬╬╬╬███
// ... | 3,001 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;
const int inf = 1e9;
int n, k;
int id[maxn], L[maxn], R[maxn];
vector<int> ... | 632 |
Project_CodeNet | 2,017 | #include<iostream>
#include<cstdio>
using namespace std;
const int maxn=1e6;
const int N=1e5+10;
const int inf=1e9;
int n;
struct edge{int to,Next;}ed[N<<1];
int edcnt,head[N];
void addedge(int u,int v){ed[++edcnt]=(edge){v,head[u]};head[u]=edcnt;}
int le[N],ri[N];
void dfslr(int u,int Fa)
{
for(int i=head[u];i;i=ed[i... | 675 |
Project_CodeNet | 2,019 | #include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int maxn=1e5+7;
vi G[maxn];
int val[maxn];
int vis[maxn];
int ti;
typedef pair<int,int> pi;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
for(int i=1,u,v;i<n;i++){
cin>>u>>v;
G[u].push_back(v);
G[v].push_b... | 313 |
Project_CodeNet | 2,017 | #include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int... | 423 |
Project_CodeNet | 2,018 | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#define ... | 580 |
Project_CodeNet | 2,016 | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
const int INF = INT_MAX / 2; //int_max->2*e+9 LLの時はLLONG_MAX
#define MP make_pair
const P pINF=MP(-INF,INF);
const P fail=MP(INF,-INF);
vector<P> range;
vector<int> graph[100001];
bool visited[100001];
P dfs(int v){
if(visited[v])
... | 643 |
Project_CodeNet | 2,019 | #include <bits/stdc++.h>
using namespace std;
#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using int32 = int_fast32_t;
using uint32 = uint_fast32_... | 857 |
Project_CodeNet | 2,018 | #include<bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int> > edge[100005];
int dis[100005];
bool check[100005];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
for(int i=... | 453 |
Project_CodeNet | 2,019 | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
#define N 100050
int head[N],to[N<<1],nxt[N<<1],cnt,n,K,is[N],vv[N],dep[N],root,need[N],mn[N],ans[N],siz[N];
void gun() {puts("No"); exit(0);}
inline void add(int u,int v) {
to[++cnt]=v; nxt[cnt]=head[u]; head[u]=cnt;
}
v... | 503 |
Project_CodeNet | 2,020 |
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
ll c=a%i_7;
if(c>=0)r... | 966 |
Project_CodeNet | 2,019 | # include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stac... | 936 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 500010, inf = 1e9 + 233;
struct edge{int too, pre;}e[maxn << 1];
int n, x, y, tot, root, m;
int dep[maxn], mn[maxn][2], a[maxn], last[maxn];
inline void add(int x, int y) {e[++tot] = (edge){y, last[x]}; last[x] = tot;}
void dfs(int x, int fa)
{
if (a[x]... | 669 |
Project_CodeNet | 2,019 | /*Program from Luvwgyx*/
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fir first
#define sec second
#define pi pair<int ,int >
#define mp(x,y) make_pair(x,y)
#define int long long
using namespace std;
const int inf=1e9;
const int maxn=1e5+10;
priority_queue<pi >q;
int n,K,tot,a[maxn],he... | 496 |
Project_CodeNet | 2,016 | #ifdef LOCAL111
#define _GLIBCXX_DEBUG
#else
#define NDEBUG
#endif
#include <bits/stdc++.h>
const long long INF = 1e9;
using namespace std;
//library
typedef int cost_t;
class Edge {
public:
int to;
long long cost;
Edge(){
}
Edge(int x,cost_t y){
to = x;
cost = y;
}
bool operator< (const Edge& x) con... | 2,311 |
Project_CodeNet | 2,020 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
vector <int> adj[N];
int l[N], r[N], t[N], ans[N];
int f(int lx, int rx, int v) {
if(!t[v]) {
t[v] = 1;
l[v] = lx;
r[v] = rx;
} else {
if((l[v] - lx) & 1) {
return 0;
}
if(lx > r[v] || rx < l[v]) {
return 0;
}
l[v] = max(l... | 567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.