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 <iostream> | |
#include <queue> | |
using namespace std; | |
int n,m,a,b,k; | |
int dist[150000]; | |
bool inq[150000]; | |
struct Edge{ | |
int u,v,c,next; | |
}edge[150000]; | |
int e=0,head[150000]; |
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 <iostream> | |
using namespace std; | |
int a,b,c; | |
int t,g; | |
int father[6000]; | |
int getfather(int a){ | |
if(father[a]==a) return a; | |
else father[a]=getfather(father[a]); | |
return father[a]; | |
} |
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> | |
using namespace std; | |
long long q; | |
float CarmSqrt(float x){ | |
union{ | |
int intPart; | |
float floatPart; | |
} convertor; | |
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 <iostream> | |
using namespace std; | |
int n,c[1000000],m; | |
int t,g,l; | |
int low(int x){ | |
return x&(-x); | |
} | |
int sum(int x){ | |
int sum=0; | |
while(x>0){ |
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 <iostream> | |
using namespace std; | |
struct Node | |
{ | |
long long left; | |
long long right; | |
long long delta; | |
long long sum; | |
Node *lc; |
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 <iostream> | |
#include <cstdio> | |
using namespace std; | |
const int | |
d[4][2]={0,1, | |
0,-1, | |
1,0, |
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<iostream> | |
#include<cstdio> | |
#include<ctype.h> | |
using namespace std; | |
inline int readint() | |
{ | |
char c=getchar(); | |
while(!isdigit(c))c=getchar(); | |
int x=0; |
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 <class T> | |
static void read(T &rec) | |
{ | |
rec=0; | |
char c; | |
while((c=getchar())<'0' || c>'9'); | |
while(c>='0' && c<='9') | |
{ | |
rec=(rec<<3)+(rec<<1)+(c-'0'); | |
c=getchar(); |
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
//http://acm.hdu.edu.cn/showproblem.php?pid=1166 | |
#include <iostream> | |
#include <stdio.h> | |
#include <string.h> | |
#define N 50005 | |
using namespace std; | |
int M; | |
int T[N*4]; | |
int Query(int s,int t){ |
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 <semaphore.h> | |
#include <random> | |
sem_t begin_sem1; | |
sem_t begin_sem2; | |
sem_t end_sem; | |
int X, Y; | |
int r1, r2; |
OlderNewer