Algorithm------技巧--尺举法
OJBFOWE
望尽天涯路,不知回首。
念尽坎坷经,方得始终。
展开
-
2017 ACM/ICPC Asia Regional Shenyang Online 1012 card
尺举法 1.初始化左端点,不断更新右端点; 2.满足条件,更新左端点,否则退出; 3.效率高于区间枚举,点的移动,复杂度O(n); 4..多数据输入,用scanf,否则超时; #include using namespace std; struct node{ int a; int原创 2017-09-10 21:25:06 · 205 阅读 · 0 评论 -
山东省第六届 ACM 省赛 Stars (矩阵尺取)
因为星星静态,没有必要树状数组,直接2*(n^2) 记录(1,1)到(i,j)的矩阵和,然后枚举任意两行,尺取即可;AC代码:#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int star[420][420]; int n,k; int chi(in...原创 2018-05-03 16:01:45 · 201 阅读 · 0 评论