Skip to content

Instantly share code, notes, and snippets.

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>

蟻本はとりあえず急いでフローを求めたい人向けの説明なので、
アルゴリズムイントロダクション(図書館にある)とかを読むのをお勧めします。
http://hos.ac/slides/20150319_flow.pdf
これが分かりやすいですかね。

用語として、 フロー、フローの残余グラフ、増加路、カット、とかは理解しておきましょう。

増加路が存在しない⇔最大フローとか、 最大フロー最小カット定理、とかは理解しておくとよい。

<html>
<head>
<title>igoclock</title>
<script>
function hoge(){
if(document.timer.player.value>=0){
document.timer.remain.value -= 1;
if(document.timer.remain.value < 0){
document.timer.player.value = -1;
document.body.style.backgroundColor = 'red';
#coding: utf-8
import threading
import socket
from BaseHTTPServer import BaseHTTPRequestHandler
import urlparse
page_head = """
<!doctype html>
type tyvar = string
type var = string
type ty =
| TyV of tyvar
| TyFun of ty * ty
| TyAll of tyvar * ty
def eval(s,inputs):
mem = [0 for i in xrange(6000)]
ip = 0
mp = 0
stack = []
def state2s():
return (
''.join(map(lambda (i,c): "*"+c if i == ip else c ,enumerate(s))) + '\n' +
str(map(lambda (i,c): "@"+str(c) if i == mp else c ,enumerate(mem[:200])))
@satos---jp
satos---jp / __writeup_STLC.md
Last active May 6, 2019 16:45
The intended solution for "STLC" in the TSG CTF 2019

The intended solution for "STLC" in the TSG CTF 2019

Step 1

When beta reducing, "capture avoiding substitution" is not taken place. For example, the term (\x. \y. x y) y should be reduced to \z. y z by renaming y to z in (\x. \y. x y), but in the interpreter, this term is reduced to \y. y y, which is ill typed lambda term. By exploiting this, the input

f1 = (\f:I->I. \g:A->A. g)
f2 = (\x:(I->I)->(A->A)->A->A. \f1:A->A. x dec) f1 (\d:A. d)
@satos---jp
satos---jp / template.cpp
Created June 30, 2019 03:42
template.cpp
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
@satos---jp
satos---jp / tips.md
Last active October 18, 2020 13:26
FStar Tips
@satos---jp
satos---jp / remote.py
Created December 5, 2019 11:48
CTFZone 2019 qual NTRU writeup
from cryptosystem import PKCS
from polynomials import Polynomial as P
from cryptosystem_edit import PKCS as PKCS_edit
from flag_params import flag_encrypted_password as encpass
cs = PKCS.importPublicKey(open('public.key').read())