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> | |
using namespace std; | |
int Set[1000001]; // Set[i]= x, x表示i的father, 最上層root的father還是自己 | |
void MakeSet(int n); | |
int FindSetRoot(int x); | |
void Union(int x, int y); | |
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 <cstdio> | |
#include <queue> | |
using namespace std; | |
typedef long long int llt; | |
int main() | |
{ | |
llt N, L; | |
while (scanf("%lld", &N) != EOF) { | |
priority_queue<llt, vector<llt>, greater<llt> > PQ; | |
for (llt i = 0; i < N; ++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 <cstdio> | |
#include <algorithm> | |
#include <queue> | |
using namespace std; | |
struct fuel_stop{ | |
int pos; | |
int amount; | |
}stop[10010]; | |
bool cmp(fuel_stop a, fuel_stop b) | |
{ |
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> | |
using namespace std; | |
struct Tree{ | |
int val = 0; | |
Tree *L = nullptr; | |
Tree *R = nullptr; | |
}; | |
Tree *Insert(Tree *H, int node) | |
{ | |
Tree *N = new Tree; |
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 <stack> | |
#include <queue> | |
using namespace std; | |
int main() | |
{ | |
// freopen("input.txt","rt",stdin); | |
int N, Command, num; | |
while (scanf("%d", &N) != EOF) { | |
stack<int> 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
#include <cstdio> | |
#include <cmath> | |
using namespace std; | |
void BST(int Left, int Right, int H); | |
int main() | |
{ | |
int Case = 1; | |
int N, H; | |
while (scanf("%d %d", &N, &H) && (N || H)) { | |
printf("Case %d:", Case++); |
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 <queue> | |
using namespace std; | |
int main() | |
{ | |
int N, x; | |
while (scanf("%d", &N) && N) { | |
priority_queue<int, vector<int>, greater<int>> PQ; | |
for (int i = 0; i < N; ++i) { | |
scanf("%d", &x); |
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 <string> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
// freopen("input.txt","rt",stdin); | |
ios::sync_with_stdio(false); |
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 <set> | |
using namespace std; | |
int Case, M, N; | |
int A[30010], U[30010]; | |
int main() | |
{ | |
freopen("input.txt","rt",stdin); | |
scanf("%d", &Case); | |
while (Case--) { |
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 <vector> | |
#include <algorithm> | |
using namespace std; | |
int A[30010]; | |
int main() | |
{ | |
// freopen("input.txt","rt",stdin); | |
int Case, M, N, tmp; | |
scanf("%d", &Case); |