0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:48:48 +00:00

chore: separate definition blocks

This commit is contained in:
Baoshuo Ren 2022-05-20 09:23:27 +08:00
parent 1636d67168
commit d5a5c18c1a
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
120 changed files with 202 additions and 42 deletions

View File

@ -11,4 +11,5 @@ AllowShortFunctionsOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true AllowShortIfStatementsOnASingleLine: true
EmptyLineBeforeAccessModifier: LogicalBlock EmptyLineBeforeAccessModifier: LogicalBlock
SeparateDefinitionBlocks: Always
PointerAlignment: Right PointerAlignment: Right

View File

@ -105,6 +105,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0), lc(0), rc(0) {} : l(0), r(0), s(0), d(0), lc(0), rc(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -7,11 +7,11 @@
* }; * };
*/ */
class Solution { class Solution {
public: public:
vector<int> printListReversingly(ListNode* head) { vector<int> printListReversingly(ListNode* head) {
vector<int> res; vector<int> res;
ListNode *tail = head; ListNode* tail = head;
while(tail != NULL) { while (tail != NULL) {
res.push_back(tail->val); res.push_back(tail->val);
tail = tail->next; tail = tail->next;
} }

View File

@ -1,29 +1,29 @@
class MyQueue { class MyQueue {
private: private:
queue<int> q; queue<int> q;
public:
public:
/** Initialize your data structure here. */ /** Initialize your data structure here. */
MyQueue() { MyQueue() {
} }
/** Push element x to the back of queue. */ /** Push element x to the back of queue. */
void push(int x) { void push(int x) {
q.push(x); q.push(x);
} }
/** Removes the element from in front of queue and returns that element. */ /** Removes the element from in front of queue and returns that element. */
int pop() { int pop() {
int ret = q.front(); int ret = q.front();
q.pop(); q.pop();
return ret; return ret;
} }
/** Get the front element. */ /** Get the front element. */
int peek() { int peek() {
return q.front(); return q.front();
} }
/** Returns whether the queue is empty. */ /** Returns whether the queue is empty. */
bool empty() { bool empty() {
return q.empty(); return q.empty();

View File

@ -15,6 +15,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), d(false), k(rand()) {} : l(0), r(0), s(0), v(0), d(false), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), d(false), k(rand()) {} : l(0), r(0), s(1), v(_v), d(false), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -11,6 +11,7 @@ struct segment {
segment() segment()
: x(0), y1(0), y2(0), k(0) {} : x(0), y1(0), y2(0), k(0) {}
segment(double _x, double _y1, double _y2, int _k) segment(double _x, double _y1, double _y2, int _k)
: x(_x), y1(_y1), y2(_y2), k(_k) {} : x(_x), y1(_y1), y2(_y2), k(_k) {}
@ -25,6 +26,7 @@ struct node {
node() node()
: l(0), r(0), cnt(0), len(0) {} : l(0), r(0), cnt(0), len(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), cnt(0), len(0) {} : l(_l), r(_r), cnt(0), len(0) {}
} tr[10005 << 3]; } tr[10005 << 3];

View File

@ -46,6 +46,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), k(rand()) {} : l(0), r(0), s(0), v(0), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), k(rand()) {} : l(0), r(0), s(1), v(_v), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -12,6 +12,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[100005 << 2]; } tr[100005 << 2];

View File

@ -11,6 +11,7 @@ struct segment {
segment() segment()
: x(0), y1(0), y2(0), k(0) {} : x(0), y1(0), y2(0), k(0) {}
segment(int _x, int _y1, int _y2, int _k) segment(int _x, int _y1, int _y2, int _k)
: x(_x), y1(_y1), y2(_y2), k(_k) {} : x(_x), y1(_y1), y2(_y2), k(_k) {}
@ -25,6 +26,7 @@ struct node {
node() node()
: l(0), r(0), cnt(0), len(0) {} : l(0), r(0), cnt(0), len(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), cnt(0), len(0) {} : l(_l), r(_r), cnt(0), len(0) {}
} tr[100005 << 3]; } tr[100005 << 3];

View File

@ -3,6 +3,7 @@
using namespace std; using namespace std;
int n, m, fa[100005], res, cnt; int n, m, fa[100005], res, cnt;
struct node { struct node {
int u, v, w; int u, v, w;

View File

@ -102,6 +102,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(-1) {} : l(0), r(0), s(0), d(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(-1) {} : l(_l), r(_r), s(0), d(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -105,6 +105,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0), lc(0), rc(0) {} : l(0), r(0), s(0), d(0), lc(0), rc(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -13,6 +13,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -9,6 +9,7 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -16,6 +16,7 @@ std::vector<int> g[N];
// Shortest Path // Shortest Path
int dist[N], max; int dist[N], max;
bool vis[N]; bool vis[N];
void spfa() { void spfa() {
memset(dist, 0x3f, sizeof(dist)); memset(dist, 0x3f, sizeof(dist));
std::queue<int> q; std::queue<int> q;

View File

@ -9,6 +9,7 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -8,10 +8,12 @@ struct node {
int x, y; int x, y;
node() {} node() {}
node(int _x, int _y) { node(int _x, int _y) {
x = _x; x = _x;
y = _y; y = _y;
} }
node operator-(node B) { node operator-(node B) {
return node(x - B.x, y - B.y); return node(x - B.x, y - B.y);
} }

View File

@ -9,12 +9,14 @@ struct node {
l = r = 0; l = r = 0;
v = -0x3f3f3f3f; v = -0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
v = -0x3f3f3f3f; v = -0x3f3f3f3f;
} }
} tr[200005 << 2]; } tr[200005 << 2];
int m, p; int m, p;
char op; char op;

View File

@ -15,6 +15,7 @@ struct node {
l = r = s = 0; l = r = s = 0;
allIsOne = false; allIsOne = false;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -10,12 +10,14 @@ struct node {
l = r = s = d = 0; l = r = s = d = 0;
x = 1; x = 1;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l, r = _r; l = _l, r = _r;
s = d = 0; s = d = 0;
x = 1; x = 1;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, p, op, x, y; int n, m, p, op, x, y;
long long k, a[100005]; long long k, a[100005];

View File

@ -107,6 +107,7 @@ struct node {
node() node()
: l(0), r(0), sum(0), max(numeric_limits<int>::min()) {} : l(0), r(0), sum(0), max(numeric_limits<int>::min()) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), sum(0), max(numeric_limits<int>::min()) {} : l(_l), r(_r), sum(0), max(numeric_limits<int>::min()) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -105,6 +105,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0), lc(0), rc(0) {} : l(0), r(0), s(0), d(0), lc(0), rc(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -16,6 +16,7 @@ int n, m, s, t, flow, cost;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// <flow, cost> // <flow, cost>
void add(int u, int v, int c, int w) { void add(int u, int v, int c, int w) {

View File

@ -15,6 +15,7 @@ class Treap {
node() node()
: left(nullptr), right(nullptr), size(1), val(0), key(rand()) {} : left(nullptr), right(nullptr), size(1), val(0), key(rand()) {}
node(int _val) node(int _val)
: left(nullptr), right(nullptr), size(1), val(_val), key(rand()) {} : left(nullptr), right(nullptr), size(1), val(_val), key(rand()) {}

View File

@ -15,6 +15,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), d(false), k(rand()) {} : l(0), r(0), s(0), v(0), d(false), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), d(false), k(rand()) {} : l(0), r(0), s(1), v(_v), d(false), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -6,6 +6,7 @@ using std::endl;
int n, m, fa[500005]; int n, m, fa[500005];
long long ans; long long ans;
struct node { struct node {
int u, v, w; int u, v, w;

View File

@ -11,12 +11,14 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = d = 0; s = d = 0;
} }
} tr[1000005 << 2]; } tr[1000005 << 2];
int n, m, op, x, y, k; int n, m, op, x, y, k;
long long a[1000005]; long long a[1000005];

View File

@ -11,6 +11,7 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -94,6 +94,7 @@ struct node {
node() node()
: l(0), r(0), d(-1) {} : l(0), r(0), d(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), d(-1) {} : l(_l), r(_r), d(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -114,6 +114,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -102,6 +102,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(-1) {} : l(0), r(0), s(0), d(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(-1) {} : l(_l), r(_r), s(0), d(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -7,6 +7,7 @@ struct node {
node() node()
: l(0), r(0), max(0) {} : l(0), r(0), max(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), max(0) {} : l(_l), r(_r), max(0) {}
} tr[50005 << 2]; } tr[50005 << 2];

View File

@ -40,6 +40,7 @@ struct node {
node() node()
: l(0), r(0), m(std::numeric_limits<int>::max()), d(0) {} : l(0), r(0), m(std::numeric_limits<int>::max()), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), m(std::numeric_limits<int>::max()), d(0) {} : l(_l), r(_r), m(std::numeric_limits<int>::max()), d(0) {}
} tr[1000005 << 1]; } tr[1000005 << 1];

View File

@ -14,12 +14,16 @@ struct node {
node() node()
: x(0), y(0), step(0) {} : x(0), y(0), step(0) {}
node(int _x, int _y) node(int _x, int _y)
: x(_x), y(_y), step(0) {} : x(_x), y(_y), step(0) {}
node(pair<int, int> _point) node(pair<int, int> _point)
: x(_point.first), y(_point.second), step(0) {} : x(_point.first), y(_point.second), step(0) {}
node(pair<int, int> _point, int _step) node(pair<int, int> _point, int _step)
: x(_point.first), y(_point.second), step(_step) {} : x(_point.first), y(_point.second), step(_step) {}
node(int _x, int _y, int _step) node(int _x, int _y, int _step)
: x(_x), y(_y), step(_step) {} : x(_x), y(_y), step(_step) {}
}; };

View File

@ -15,6 +15,7 @@ std::vector<std::pair<int, long long>> g[N];
// Dijkstra - Shortest Path // Dijkstra - Shortest Path
long long dist[N]; long long dist[N];
bool vis[N]; bool vis[N];
void dijkstra() { void dijkstra() {
memset(dist, 0x3f, sizeof(dist)); memset(dist, 0x3f, sizeof(dist));
dist[1] = 0; dist[1] = 0;

View File

@ -1,3 +1,6 @@
#include<stdio.h> #include <stdio.h>
char s[]="#include<stdio.h>%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}"; char s[] = "#include<stdio.h>%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}";
int main(){printf(s,10,32,34,s,34,59,10);}
int main() {
printf(s, 10, 32, 34, s, 34, 59, 10);
}

View File

@ -15,6 +15,7 @@ int n, s, t, a[N], sum, avg, cost;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// <flow, cost> // <flow, cost>
void add(int u, int v, int flow, int cost) { void add(int u, int v, int flow, int cost) {

View File

@ -85,6 +85,7 @@ struct node {
node() node()
: l(0), r(0), d(0) {} : l(0), r(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), d(0) {} : l(_l), r(_r), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -42,6 +42,7 @@ struct node {
node() node()
: l(0), r(0), s(0), m(0) {} : l(0), r(0), s(0), m(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), m(0) {} : l(_l), r(_r), s(0), m(0) {}
} tr[100005 << 2]; } tr[100005 << 2];

View File

@ -65,6 +65,7 @@ struct node {
node() node()
: l(0), r(0), s(0), m(0) {} : l(0), r(0), s(0), m(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), m(0) {} : l(_l), r(_r), s(0), m(0) {}
} tr[300005 << 2]; } tr[300005 << 2];

View File

@ -1,29 +1,29 @@
// R14715360 // R14715360
#include<stdio.h> #include <stdio.h>
int main() { int main() {
printf( printf(
" ********\n" " ********\n"
" ************\n" " ************\n"
" ####....#.\n" " ####....#.\n"
" #..###.....##....\n" " #..###.....##....\n"
" ###.......###### ### ###\n" " ###.......###### ### ###\n"
" ........... #...# #...#\n" " ........... #...# #...#\n"
" ##*####### #.#.# #.#.#\n" " ##*####### #.#.# #.#.#\n"
" ####*******###### #.#.# #.#.#\n" " ####*******###### #.#.# #.#.#\n"
" ...#***.****.*###.... #...# #...#\n" " ...#***.****.*###.... #...# #...#\n"
" ....**********##..... ### ###\n" " ....**********##..... ### ###\n"
" ....**** *****....\n" " ....**** *****....\n"
" #### ####\n" " #### ####\n"
" ###### ######\n" " ###### ######\n"
"##############################################################\n" "##############################################################\n"
"#...#......#.##...#......#.##...#......#.##------------------#\n" "#...#......#.##...#......#.##...#......#.##------------------#\n"
"###########################################------------------#\n" "###########################################------------------#\n"
"#..#....#....##..#....#....##..#....#....#####################\n" "#..#....#....##..#....#....##..#....#....#####################\n"
"########################################## #----------#\n" "########################################## #----------#\n"
"#.....#......##.....#......##.....#......# #----------#\n" "#.....#......##.....#......##.....#......# #----------#\n"
"########################################## #----------#\n" "########################################## #----------#\n"
"#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n" "#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n"
"########################################## ############\n" "########################################## ############\n");
);
return 0; return 0;
} }

View File

@ -5,6 +5,7 @@
using namespace std; using namespace std;
int n, m, ans; int n, m, ans;
struct node { struct node {
int k, s; int k, s;
} a[100001]; } a[100001];

View File

@ -40,6 +40,7 @@ struct node {
node() node()
: l(0), r(0), m(std::numeric_limits<int>::max()), d(0) {} : l(0), r(0), m(std::numeric_limits<int>::max()), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), m(std::numeric_limits<int>::max()), d(0) {} : l(_l), r(_r), m(std::numeric_limits<int>::max()), d(0) {}
} tr[1000005 << 1]; } tr[1000005 << 1];

View File

@ -8,6 +8,7 @@ struct node {
node() { node() {
id = chinese = math = english = all = 0; id = chinese = math = english = all = 0;
} }
node(int _id, int _chinese, int _math, int _english) { node(int _id, int _chinese, int _math, int _english) {
id = _id; id = _id;
chinese = _chinese; chinese = _chinese;

View File

@ -6,6 +6,7 @@ int n, ans[20005];
struct node { struct node {
int id, h, l, r; int id, h, l, r;
struct { struct {
int l, r; int l, r;
} ans; } ans;

View File

@ -16,6 +16,7 @@ bool check(int x) {
} }
return num >= m; return num >= m;
} }
int main() { int main() {
cin >> n >> m; cin >> n >> m;
for (int i = 1; i <= n; i++) { for (int i = 1; i <= n; i++) {

View File

@ -10,6 +10,7 @@ class node {
} }
return x - 10 + 'A'; return x - 10 + 'A';
} }
int len; int len;
int nums[20]; int nums[20];
@ -17,6 +18,7 @@ class node {
node() { node() {
len = 0; len = 0;
} }
node(int x, int b) { node(int x, int b) {
len = 0; len = 0;
while (x) { while (x) {
@ -37,6 +39,7 @@ class node {
} }
return s; return s;
} }
bool check() { bool check() {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (nums[i] != nums[len - i - 1]) { if (nums[i] != nums[len - i - 1]) {

View File

@ -47,6 +47,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 5]; } tr[N << 5];

View File

@ -11,6 +11,7 @@ struct node {
l = r = 0; l = r = 0;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
s = s2 = d = 0.00; s = s2 = d = 0.00;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = s2 = d = 0.00; s = s2 = d = 0.00;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, op, x, y; int n, m, op, x, y;
double k, a[100005]; double k, a[100005];

View File

@ -19,6 +19,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), k(rand()) {} : l(0), r(0), s(0), v(0), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), k(rand()) {} : l(0), r(0), s(1), v(_v), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
max = -0x3f3f3f3f; max = -0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
max = -0x3f3f3f3f; max = -0x3f3f3f3f;
} }
} tr[200005 << 2]; } tr[200005 << 2];
int n, m, x, y, a[200005]; int n, m, x, y, a[200005];
char op; char op;

View File

@ -5,6 +5,7 @@
using namespace std; using namespace std;
int num[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4}; int num[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4};
// a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v. w, x, y, z // a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v. w, x, y, z
int main() { int main() {
char c; char c;

View File

@ -8,6 +8,7 @@ int dx2[25] = {-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0,
1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2}; 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
int main() { int main() {
cin >> n >> m >> k; cin >> n >> m >> k;
int a[n + 5][n + 5]; int a[n + 5][n + 5];

View File

@ -40,6 +40,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), k(rand()) {} : l(0), r(0), s(0), v(0), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), k(rand()) {} : l(0), r(0), s(1), v(_v), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, x, y, a[100005]; int n, m, x, y, a[100005];
void pushup(int u) { void pushup(int u) {

View File

@ -1,4 +1,5 @@
extern "C" int Seniorious(int); extern "C" int Seniorious(int);
extern "C" int Chtholly(int n, int OvO) { extern "C" int Chtholly(int n, int OvO) {
int ans = 1; int ans = 1;
int l = 1, r = n; int l = 1, r = n;

View File

@ -8,6 +8,7 @@ struct node {
node() { node() {
x1 = x2 = 0; x1 = x2 = 0;
} }
node(int _x1, int _x2, int _y) { node(int _x1, int _x2, int _y) {
x1 = _x1; x1 = _x1;
x2 = _x2; x2 = _x2;

View File

@ -10,12 +10,14 @@ struct node {
l = r = s = d = 0; l = r = s = d = 0;
x = 1; x = 1;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l, r = _r; l = _l, r = _r;
s = d = 0; s = d = 0;
x = 1; x = 1;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, p, op, x, y; int n, m, p, op, x, y;
long long k, a[100005]; long long k, a[100005];

View File

@ -5,6 +5,7 @@ using namespace std;
struct { struct {
int s, b; int s, b;
} a[15]; } a[15];
int n, ans = 0x3f3f3f3f; int n, ans = 0x3f3f3f3f;
void dfs(int now, int s, int b) { void dfs(int now, int s, int b) {

View File

@ -15,6 +15,7 @@ int n, k, s, t, ans;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// <flow, cost> // <flow, cost>
void add(int u, int v, int flow, int cost) { void add(int u, int v, int flow, int cost) {

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
s = 0; s = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = 0; s = 0;
} }
} tr[1000005 << 2]; } tr[1000005 << 2];
long long n, w, a, b; long long n, w, a, b;
char op; char op;

View File

@ -9,6 +9,7 @@ struct node {
w = 0; w = 0;
c = 0; c = 0;
} }
node(long long _w, long long _c) { node(long long _w, long long _c) {
w = _w; w = _w;
c = _c; c = _c;

View File

@ -102,6 +102,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(-1) {} : l(0), r(0), s(0), d(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(-1) {} : l(_l), r(_r), s(0), d(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -15,6 +15,7 @@ int n, m, s, t, flow, cost;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// <flow, cost> // <flow, cost>
void add(int u, int v, int flow, int cost) { void add(int u, int v, int flow, int cost) {

View File

@ -11,6 +11,7 @@ struct node {
l = r = 0; l = r = 0;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -39,6 +39,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), k(rand()) {} : l(0), r(0), s(0), v(0), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), k(rand()) {} : l(0), r(0), s(1), v(_v), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -11,6 +11,7 @@ struct node {
s = 0; s = 0;
d = 0; d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
@ -18,6 +19,7 @@ struct node {
d = 0; d = 0;
} }
} tr[200005 << 3]; } tr[200005 << 3];
int n, f, op, x, y, k, a[200005]; int n, f, op, x, y, k, a[200005];
void pushup(int u) { void pushup(int u) {

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
s = ""; s = "";
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = ""; s = "";
} }
} tr[50005 << 2]; } tr[50005 << 2];
int n, m, x, y; int n, m, x, y;
string a[50005], b[50005]; string a[50005], b[50005];
map<string, string> m1; map<string, string> m1;

View File

@ -8,6 +8,7 @@ struct node {
node() { node() {
l = r = max = 0; l = r = max = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -105,6 +105,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0), lc(0), rc(0) {} : l(0), r(0), s(0), d(0), lc(0), rc(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0), lc(0), rc(0) {} : l(_l), r(_r), s(0), d(0), lc(0), rc(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -16,6 +16,7 @@ struct data {
data() { data() {
a = b = 0; a = b = 0;
} }
data(int _a, int _b) { data(int _a, int _b) {
int g = __gcd(_a, _b); int g = __gcd(_a, _b);
a = _a / g; a = _a / g;
@ -25,9 +26,11 @@ struct data {
bool operator<(const data& x) const { bool operator<(const data& x) const {
return a * x.b < b * x.a; return a * x.b < b * x.a;
} }
bool operator>(const data& x) const { bool operator>(const data& x) const {
return a * x.b > b * x.a; return a * x.b > b * x.a;
} }
bool operator==(const data& x) const { bool operator==(const data& x) const {
return a * x.b == b * x.a; return a * x.b == b * x.a;
} }

View File

@ -5,15 +5,18 @@ using namespace std;
struct node { struct node {
int l, r; int l, r;
int s, d; int s, d;
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = d = 0; s = d = 0;
} }
} tr[200005 << 2]; } tr[200005 << 2];
int n, m, op, x, y, a[200005]; int n, m, op, x, y, a[200005];
void pushup(int u) { void pushup(int u) {

View File

@ -107,6 +107,7 @@ struct node {
node() node()
: l(0), r(0), sum(0), max(numeric_limits<int>::min()) {} : l(0), r(0), sum(0), max(numeric_limits<int>::min()) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), sum(0), max(numeric_limits<int>::min()) {} : l(_l), r(_r), sum(0), max(numeric_limits<int>::min()) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -8,12 +8,14 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = d = 0; s = d = 0;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, op, s, e; int n, m, op, s, e;
void pushup(int u) { void pushup(int u) {

View File

@ -9,6 +9,7 @@ struct node {
l = r = max = 0; l = r = max = 0;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
@ -16,6 +17,7 @@ struct node {
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
} tr[50005 << 2]; } tr[50005 << 2];
int n, q, a, b, h[50005]; int n, q, a, b, h[50005];
void pushup(int u) { void pushup(int u) {

View File

@ -11,6 +11,7 @@ struct node {
node() { node() {
x = y = t = 0; x = y = t = 0;
} }
node(int _x, int _y, int _t) { node(int _x, int _y, int _t) {
x = _x, y = _y, t = _t; x = _x, y = _y, t = _t;
} }

View File

@ -6,6 +6,7 @@ struct node {
int v, l, c; int v, l, c;
node() {} node() {}
node(int _v, int _l, int _c) node(int _v, int _l, int _c)
: v(_v), l(_l), c(_c) {} : v(_v), l(_l), c(_c) {}
}; };

View File

@ -114,6 +114,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -8,12 +8,14 @@ struct node {
node() { node() {
l = r = s = 0; l = r = s = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = 0; s = 0;
} }
} tr[1000005 << 2]; } tr[1000005 << 2];
int n, w, x, b, ans; int n, w, x, b, ans;
void pushup(int u) { void pushup(int u) {

View File

@ -3,6 +3,7 @@
using namespace std; using namespace std;
int n, m, fa[5005], res, cnt; int n, m, fa[5005], res, cnt;
struct node { struct node {
int u, v, w; int u, v, w;

View File

@ -12,6 +12,7 @@ struct node {
d = 0; d = 0;
s = 0; s = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
@ -19,6 +20,7 @@ struct node {
d = 0; d = 0;
} }
} tr[500005 << 2]; } tr[500005 << 2];
int n, m, op, x, y, k, a[500005]; int n, m, op, x, y, k, a[500005];
void pushup(int u) { void pushup(int u) {

View File

@ -12,12 +12,14 @@ struct node {
node() { node() {
l = r = s = d = 0; l = r = s = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = d = 0; s = d = 0;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, op, x, y, k, a[100005]; int n, m, op, x, y, k, a[100005];
/** /**

View File

@ -10,12 +10,14 @@ struct node {
l = r = s = d = 0; l = r = s = d = 0;
x = 1; x = 1;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l, r = _r; l = _l, r = _r;
s = d = 0; s = d = 0;
x = 1; x = 1;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, p, op, x, y; int n, m, p, op, x, y;
long long k, a[100005]; long long k, a[100005];
@ -90,10 +92,10 @@ void modify(int u, int l, int r, long long x, long long d) {
/** /**
* @brief * @brief
* @param u * @param u
* @param l * @param l
* @param r * @param r
* @return int * @return int
*/ */
long long query(int u, int l, int r) { long long query(int u, int l, int r) {
if (tr[u].l >= l && tr[u].r <= r) { // 被包含直接返回 if (tr[u].l >= l && tr[u].r <= r) { // 被包含直接返回

View File

@ -16,6 +16,7 @@ int n, m, s, t, flow, cost;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// < c, w> // < c, w>
void add(int u, int v, int c, int w) { void add(int u, int v, int c, int w) {

View File

@ -65,6 +65,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -11,6 +11,7 @@ struct node {
node() { node() {
u = v = w = 0; u = v = w = 0;
} }
node(int _u, int _v, int _w) { node(int _u, int _v, int _w) {
u = _u; u = _u;
v = _v; v = _v;

View File

@ -48,6 +48,7 @@ void tarjan(int u) {
// Shortest Path // Shortest Path
int dist[N]; int dist[N];
int spfa(int s) { int spfa(int s) {
memset(dist, -0x3f, sizeof(dist)); memset(dist, -0x3f, sizeof(dist));
std::queue<int> q; std::queue<int> q;

View File

@ -15,6 +15,7 @@ struct node {
node() node()
: l(0), r(0), s(0), v(0), d(false), k(rand()) {} : l(0), r(0), s(0), v(0), d(false), k(rand()) {}
node(int _v) node(int _v)
: l(0), r(0), s(1), v(_v), d(false), k(rand()) {} : l(0), r(0), s(1), v(_v), d(false), k(rand()) {}
} tr[N]; } tr[N];

View File

@ -95,6 +95,7 @@ struct node {
node() node()
: l(0), r(0), s(0), d(0) {} : l(0), r(0), s(0), d(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), s(0), d(0) {} : l(_l), r(_r), s(0), d(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -15,6 +15,7 @@ struct node {
s = d = 0; s = d = 0;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, op, a, b; int n, m, op, a, b;
void pushup(int u) { void pushup(int u) {

View File

@ -15,6 +15,7 @@ int n, s, t, a[N], sum, avg, cost;
// Graph // Graph
int idx, head[N], ver[M << 1], next[M << 1]; int idx, head[N], ver[M << 1], next[M << 1];
std::pair<int, int> edge[M << 1]; std::pair<int, int> edge[M << 1];
// <flow, cost> // <flow, cost>
void add(int u, int v, int flow, int cost) { void add(int u, int v, int flow, int cost) {

View File

@ -94,6 +94,7 @@ struct node {
node() node()
: l(0), r(0), d(-1) {} : l(0), r(0), d(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), d(-1) {} : l(_l), r(_r), d(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -96,6 +96,7 @@ struct node {
node() node()
: l(0), r(0), m(0) {} : l(0), r(0), m(0) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), m(0) {} : l(_l), r(_r), m(0) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -14,6 +14,7 @@ struct node {
l = r = s = 0; l = r = s = 0;
allIsOne = false; allIsOne = false;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;

View File

@ -126,6 +126,7 @@ struct node {
node() node()
: l(0), r(0), m(0), da(0), dc(-1) {} : l(0), r(0), m(0), da(0), dc(-1) {}
node(int _l, int _r) node(int _l, int _r)
: l(_l), r(_r), m(0), da(0), dc(-1) {} : l(_l), r(_r), m(0), da(0), dc(-1) {}
} tr[N << 2]; } tr[N << 2];

View File

@ -10,12 +10,14 @@ struct node {
l = r = 0; l = r = 0;
s = 0; s = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
s = 0; s = 0;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int t, q, mod, op, m; int t, q, mod, op, m;
void pushup(int u) { void pushup(int u) {

View File

@ -14,12 +14,16 @@ struct node {
node() node()
: x(0), y(0), step(0) {} : x(0), y(0), step(0) {}
node(int _x, int _y) node(int _x, int _y)
: x(_x), y(_y), step(0) {} : x(_x), y(_y), step(0) {}
node(pair<int, int> _point) node(pair<int, int> _point)
: x(_point.first), y(_point.second), step(0) {} : x(_point.first), y(_point.second), step(0) {}
node(pair<int, int> _point, int _step) node(pair<int, int> _point, int _step)
: x(_point.first), y(_point.second), step(_step) {} : x(_point.first), y(_point.second), step(_step) {}
node(int _x, int _y, int _step) node(int _x, int _y, int _step)
: x(_x), y(_y), step(_step) {} : x(_x), y(_y), step(_step) {}
}; };

View File

@ -9,12 +9,14 @@ struct node {
l = r = 0; l = r = 0;
v = d = 0; v = d = 0;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
v = d = 0; v = d = 0;
} }
} tr[100005 << 2]; } tr[100005 << 2];
int n, m, t, x, y; int n, m, t, x, y;
void build(int u, int l, int r) { void build(int u, int l, int r) {

View File

@ -9,12 +9,14 @@ struct node {
l = r = 0; l = r = 0;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
node(int _l, int _r) { node(int _l, int _r) {
l = _l; l = _l;
r = _r; r = _r;
min = 0x3f3f3f3f; min = 0x3f3f3f3f;
} }
} tr[25005 << 2]; } tr[25005 << 2];
int n, q, x, y, a[25005]; int n, q, x, y, a[25005];
void pushup(int u) { void pushup(int u) {

Some files were not shown because too many files have changed in this diff Show More