This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from flask import Flask,request,render_template, g, flash, send_from_directory | |
import datetime | |
import locale | |
from sqlite3 import dbapi2 as sqlite3 | |
from werkzeug import secure_filename | |
DATABASE = "./tmp/fileserver.db" | |
TMP_FOLDER = "./tmp/" | |
app = Flask(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FOR(i, b, e) for (typeof(e) i = (b); i < (e); ++i) | |
// for arrays | |
#define arrsz(a) ( sizeof(a) / sizeof(a[0]) ) | |
#define darr(a) if (opt_debug) { copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl; } | |
#define darr2(a) if (opt_debug) { FOR(__i, 0, (arrsz(a))){ darr( (a)[__i] ); } } | |
// for vectors | |
#define ALL(a) (a).begin(), (a).end() | |
#define dvec(v) if (opt_debug) { copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 : ( 24 48 68 73 74 89 99 ) | |
1 : ( 20 34 46 47 54 71 78 ) | |
2 : ( 6 13 14 16 23 25 28 29 30 37 41 43 50 51 53 55 58 59 60 61 65 66 69 70 72 75 79 83 84 85 86 88 90 92 94 97 ) | |
3 : ( 1 7 15 26 33 36 38 64 76 80 81 91 96 100 ) | |
4 : ( 3 17 35 44 45 52 67 77 ) | |
5 : ( 9 10 21 27 87 ) | |
6 : ( 4 62 82 95 98 ) | |
7 : ( 5 18 31 39 40 56 ) | |
8 : ( 8 12 22 32 42 57 63 ) | |
9 : ( 2 11 19 49 93 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuickFind(object): | |
""" | |
Implements the quick find algorithm for the dynamic connectivity problem | |
Cost model (in array read/writes): | |
Initialization: N | |
Union: N | |
Find: 1 | |
Algorithm: |
NewerOlder