随笔分类 - 问题
摘要:很CHUO的代码用的是单调队列还有更好的做法 以后补上#include <stdio.h>struct Queue{ int idx, val;}que[1000000];int a[1000000];int head, tail;int main(){ int n, k; scanf("%d%d",&n, &k); for(int i = 0; i < n; ++i){ scanf("%d",&a[i]); } // k 为1时候的特殊情况, 还有更好的做法.. if( k == 1 ){ for(int i
阅读全文
摘要:明显的优先队列用了STL,但是不全懂,自己写个堆估计悬... 有工具咱就用!#include <iostream>#include <queue>#include <vector>#include <stdio.h>using namespace std;const int MAXN = 60001;struct message{ char name[20]; int para,pri; int order; bool operator < (const message& m1)const { if(pri == m1.pri) r
阅读全文
摘要:还得好好理解一下...为什么注释部分去掉 不能AC ? 知道的麻烦指导一下!#include <stdio.h>#define L(x) ((x) << 1)#define R(x) ((x) << 1 | 1)const int MAXN = 200000;struct SegTree{ int l,r; int metal; int value; bool lazy; int getMid(){ return ( l + r ) >> 1; } int getDis(){ return (r - l + 1); }}tree[MAXN <
阅读全文
摘要:#include <stdio.h>#include <string.h>#include <queue>using namespace std;const int MAXN = 250010;const int K = 26;struct Trie{ int wordEnd; int fail; int next[K]; void init(){ wordEnd = 0; fail = -1; memset(next, 0, sizeof(next)); } }tree[MAXN];int cnt;char str[1000010];void prePro
阅读全文

浙公网安备 33010602011771号