Skip to content

Commit

Permalink
5.20
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcxzyw committed May 20, 2019
1 parent 464b053 commit 7a56f68
Show file tree
Hide file tree
Showing 19 changed files with 240 additions and 53 deletions.
2 changes: 0 additions & 2 deletions Checker/Adapters/UOJJudger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ static bool readOpt(Option& opt,
maxTime * 1000000));
opt.insert("MemoryLimit", maxMem << 10);
opt.insert("CompareMode", CompareMode::Text);
opt.insert("TimeSamples",
fs::path("CheckerDir/UOJ-Samples"));
return true;
}
static bool runUOJ(const fs::path& exec) {
Expand Down
4 changes: 0 additions & 4 deletions Checker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ endif(NOT HAS_UNZIP)
find_program(HAS_PERF perf)
find_program(HAS_SYZOJTOOLS syzoj)

set (CHECKER_VERSION_MAJOR 2)
set (CHECKER_VERSION_MINOR 9)
set (CHECKER_VERSION_PATCH 0)

option(BZOJ_JUDGER "bzoj-judger" ON)
option(LOJ_JUDGER "loj-judger" ON)
option(UOJ_JUDGER "uoj-judger" ON)
Expand Down
4 changes: 2 additions & 2 deletions Checker/Checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ int main() {
std::cout.precision(2);
std::cout << std::fixed;

line("Checker " VERSION, '*');
line("Checker for " CHECKER_PLATFORM " 2.9.1",
'*');
std::cout << "Built at " << __TIME__ << " on "
<< __DATE__ << std::endl;
platformInfo();
fs::path exec = scanExec();
std::cout << "found program:" << exec << std::endl;
autoRun(exec);
Expand Down
2 changes: 1 addition & 1 deletion Checker/CheckerConfig.hpp.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define VERSION "@CHECKER_VERSION_MAJOR@.@CHECKER_VERSION_MINOR@.@CHECKER_VERSION_PATCH@"
#define CHECKER_PLATFORM "@CMAKE_SYSTEM_NAME@"
#cmakedefine USE_SYZOJTOOLS
#cmakedefine USE_PERF
3 changes: 0 additions & 3 deletions Checker/Platforms/Linux/PlatformLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
void platformInfo() {
system("lsb_release -d");
}
void initPlatform() {
struct rlimit limit;
getrlimit(RLIMIT_STACK, &limit);
Expand Down
1 change: 0 additions & 1 deletion Checker/Platforms/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
#include "Linux/PlatformLinux.hpp"
#endif
void initPlatform();
void platformInfo();
void reportJudgeError(const RunResult& res);
int getConsoleWidth();
3 changes: 0 additions & 3 deletions Checker/Platforms/Windows/PlatformWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ void initPlatform() {
old | ENABLE_VIRTUAL_TERMINAL_PROCESSING));
setCodePage(65001);
}
void platformInfo() {
system("ver");
}
static const std::string& getWinntHeader() {
static std::string str =
file2Str(readConfig("WinntHeader"));
Expand Down
5 changes: 4 additions & 1 deletion Checker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ AC后询问OJ上的时间并加入samples中,在BZOJ计时方式下skip掉剩
2.8.4(5.14)
修复系统时间超时产生SIGXCPU信号,误判TLE的问题。

2.9.0(5.15)
2.9.0(5.18)
支持UOJ题目读取与样例数据下载

2.9.1(5.19)
取消UOJ的TimeSample(样例数据与评测数据不同)

## TODO List

- [x] 跨Windows平台、分离平台实现
Expand Down
3 changes: 2 additions & 1 deletion OI-Source.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"source_location": "cpp",
"*.idl": "cpp",
"hash_map": "cpp",
"hash_set": "cpp"
"hash_set": "cpp",
"decimal": "cpp"
},
"latex-workshop.intellisense.citation.maxfilesizeMB": 128,
"latex-workshop.latex.recipes": [
Expand Down
1 change: 1 addition & 0 deletions Queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
# minmax容斥
- [x] LOJ#2542. 「PKUWC2018」随机游走
- [x] LOJ#2127. 「HAOI2015」按位或(做完后作为minmax容斥的例题)
- [ ] UOJ#449
# FFT/NTT/FWT/生成函数
- [x] LOJ#151. 多项式求立方根
- [x] LOJ#2527. 「HAOI2018」染色
Expand Down
45 changes: 45 additions & 0 deletions Review/Backmatter.tex
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,48 @@ \subsection{day2}
就叫我滚回去学文化课了。

混了两年换来这个结果。不仅没得到想要的,还失去了许多。。。这就是人生?
\section{End}
2019年5月20日

最后一次比赛后我就再也碰不了电子设备了,所以这里提前做个收尾。

THUSC2019应该是我OI生涯中的最后一站吧。我也大概知道了结局,否则也不会花一个月的时间搞
THUAC,甚至抽时间刷电影,这两个是我一直想做但忍着不做的事。

我没能达到自己的要求,既不能留住她,也不能让自己走出失恋的阴影,从而丧失刷题的动力。

我还有一堆的TODO没有做完,如果我能撑到高中毕业而没有崩溃的话,我会抽时间完成它的。但是不
再加入新的东西。如果有学弟愿意接手这个烂摊子,可以发Pull Request给我。

至于开班造学弟的事情,由于我可能上不了很好的大学,会成为反面教材,并且加上近年来moe对
竞赛方面自主招生的打压,应该不会有家长送人来,学校也不会配合的。我能留给学弟的,只有这
本笔记,附赠一个Checker。

送给学弟们的忠告:
\begin{itemize}
\item 适当地娱乐,要注意调整比例。我当时靠着鼓捣CG还能保持0娱乐,离开它后整个人
就变得毫无生气,离开她后就开始颓废。
\item 尽量组团学习,同等级OIer之间的交流可以大量节约时间,而且不会感到孤独。
\item 我在笔记中标记的坑,一定要记住。这是我用时间与分数换来的。
\item 多训练思维。在掌握笔记中的知识后,你们能做的只有裸题而已。要思考如何将考点隐藏,
如何转化。
\item 多出题。上面一条我也做不到,因为我能接触到的题目少。如果你们是组团学习的,可以考虑
互相出题,互相Hack,这同样是一种训练。多Hack可以熟悉出题人可以怎样卡掉某个算法。
\item 多打比赛。平时训练和比赛时的心理与策略是十分不同的。缺少比赛也是我的不足。
\item 所以说,只要人数多,你们就可以自己出题,举办校赛,赛后hack,这样的训练效果比我自己
一个人刷题好得多。
\item 同样重视数学和编程方面的训练。虽然OI侧重于算法设计,但是数学功底好就可以快速
推导式子,提高对语言的掌握程度可以减少bug。
\item 如果有事找我,请确保你的C++代码大括号不换行。其它的代码风格我可以兼容,但是大括号
免谈。
\end{itemize}

希望将来我校有人能完成我未能完成的梦想,最好能挑大梁,培养更多的学弟学妹。

希望这本笔记对你们有一些帮助。

\begin{figure}
\centering
\includegraphics[width=0.8\textwidth,clip]{mypic.jpg}
\caption{这应该是本笔记唯一一张图了}
\end{figure}
1 change: 1 addition & 0 deletions Review/Main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
\dominitoc[n]
\usepackage{shorttoc}
%Feature
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{CJKfntef}
\newfontfamily\CodeFont{Consolas}
Expand Down
2 changes: 1 addition & 1 deletion Review/Math/Inversion.tex
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ \subsubsection{期望形式}

\paragraph{例题~「HAOI2015」按位或}
$max(S)$为状态S中最晚出现的1的出现的期望时间,$min(S)$为状态S中最早出现
的1的出现的期望时间$min(S)$很容易求得其表达式,考虑与$S$的交不为空集的$T$,表达式为
的1的出现期望时间$min(S)$很容易求得其表达式,考虑与$S$的交不为空集的$T$,表达式为
$min(S)=\frac{1}{\displaystyle \sum_{T\cap S \neq \emptyset}{P_T}}$(根据
伯努利试验中几何分布的期望求得,参见第~\ref{Bernoulli}节)。
这个式子仍然不好求,可以考虑补集转换,即考虑$T$$S$的交为空集的情况。这个条件蕴含了
Expand Down
3 changes: 3 additions & 0 deletions Review/Optmize/LP.tex
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ \subsubsection{初始化init}
\subsubsection{算法实现(UOJ179)}
为了过掉UOJ的Extra Test,这里使用了两种初始化方法的混合(然而还是过不去,
只能指望Mehrotra predictor–corrector method了)。

Update:事实上应该是浮点数精度不够。

\lstinputlisting{Source/Templates/SimplexSLP.cpp}

\subsubsection{稀疏矩阵优化}
Expand Down
Binary file added Review/mypic.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
11 changes: 11 additions & 0 deletions Source/Network Flows/POJ2175.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <cstdio>
const int size = 105;
struct Point {
int x, y, z;
} A[size], B[size];
int main() {
int n, m;
scanf("%d%d", &n, &m);

return 0;
}
78 changes: 44 additions & 34 deletions Templates/Simplex.cpp → Templates/UOJ179-Simplex.cpp
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
#include <algorithm>
#include <cmath>
#include <iostream>
int getRandom() {
static int seed = 2354;
return seed = seed * 48271LL % 2147483647;
typedef float FT __attribute__((mode(TF)));
const FT epsA = 1e-10, epsB = 1e-20, epsC = 1e-30,
zero = 0, one = 1;
FT mabs(FT val) {
return val >= zero ? val : -val;
}
typedef long double FT;
const FT eps = 1e-10;
const int size = 25;
FT A[size][size];
int id[size * 2], n, m;
int idn[size], idm[size], n, m;
void pivot(int l, int e) {
std::swap(id[n + l], id[e]);
std::swap(idm[l], idn[e]);
FT fac = A[l][e];
A[l][e] = 1.0;
A[l][e] = one;
for(int i = 0; i <= n; ++i)
A[l][i] /= fac;
for(int i = 0; i <= m; ++i)
if(i != l) {
FT k = A[i][e];
A[i][e] = 0.0;
A[i][e] = zero;
for(int j = 0; j <= n; ++j)
A[i][j] -= k * A[l][j];
}
}
int q[size];
bool init() {
idm[0] = idn[0] = 1 << 30;
while(true) {
int qcnt = 0;
int l = 0;
for(int i = 1; i <= m; ++i)
if(A[i][0] < -eps)
q[qcnt++] = i;
if(qcnt == 0)
break;
int l = q[getRandom() % qcnt];
qcnt = 0;
if(A[i][0] < -epsA && idm[i] < idm[l])
l = i;
if(l == 0)
return true;
int e = 0;
for(int i = 1; i <= n; ++i)
if(A[l][i] < -eps)
q[qcnt++] = i;
if(qcnt == 0)
if(A[l][i] < -epsA && idn[i] < idn[e])
e = i;
if(e == 0)
return false;
int e = q[getRandom() % qcnt];
pivot(l, e);
}
return true;
}
bool simplex() {
if(!init()) {
Expand All @@ -53,21 +50,19 @@ bool simplex() {
while(true) {
int e = 0;
for(int i = 1; i <= n; ++i)
if(A[0][i] > eps) {
if(A[0][i] > epsB && idn[i] < idn[e])
e = i;
break;
}
if(e == 0)
break;
FT minv = 1e20;
FT minv = 1e200;
int l = 0;
for(int i = 1; i <= m; ++i)
if(A[i][e] > eps) {
if(A[i][e] > epsB) {
FT val = A[i][0] / A[i][e];
if(val < minv) {
minv = val;
l = i;
}
if(l == 0 || val < minv ||
(mabs(val - minv) < epsC &&
idm[i] < idm[l]))
minv = val, l = i;
}
if(l == 0) {
std::cout << "Unbounded" << std::endl;
Expand All @@ -77,7 +72,20 @@ bool simplex() {
}
return true;
}
FT ans[size];
FT ans[size * 2];
typedef long long Int64;
std::istream& operator>>(std::istream& in, FT& val) {
Int64 tmp;
in >> tmp;
val = tmp;
// if(static_cast<Int64>(val) != tmp)
// throw;
return in;
}
typedef long double IOFT;
std::ostream& operator<<(std::ostream& out, FT val) {
return out << static_cast<IOFT>(val);
}
int main() {
int t;
std::cin >> n >> m >> t;
Expand All @@ -89,14 +97,16 @@ int main() {
std::cin >> A[i][0];
}
for(int i = 1; i <= n; ++i)
id[i] = i;
idn[i] = i;
for(int i = 1; i <= m; ++i)
idm[i] = n + i;
std::cout.precision(14);
if(simplex()) {
std::cout << std::fixed << -A[0][0]
<< std::endl;
if(t) {
for(int i = 1; i <= m; ++i)
ans[id[n + i]] = A[i][0];
ans[idm[i]] = A[i][0];
for(int i = 1; i <= n; ++i)
std::cout << std::fixed << ans[i]
<< ' ';
Expand Down

0 comments on commit 7a56f68

Please sign in to comment.