Skip to content

Commit

Permalink
icpc final is tomorrow
Browse files Browse the repository at this point in the history
  • Loading branch information
brpapa committed Jul 9, 2021
1 parent adb10d9 commit 8149397
Show file tree
Hide file tree
Showing 6 changed files with 351 additions and 297 deletions.
1 change: 1 addition & 0 deletions .vscode/snippets.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"#include <bits/stdc++.h>",
"using namespace std;",
"typedef long long ll;",
"const int INF = 1 << 30;",
"",
"int main() {",
" $0",
Expand Down
11 changes: 7 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@
"description": "Select the folder",
"type": "pickString",
"options": [
"at-coder",
"code-jam",
"codeforces",
"uva",
"uri",
"kattis",
"live-archive",
"spoj",
"code-jam",
"live-archive"
"timus",
"uri",
"uva"
],
},
{
Expand Down
31 changes: 15 additions & 16 deletions notebook/dynamic-programming/lis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ const int INF = 1 << 30;

/* input */
vector<int> A = {-7, 10, 5, 2, 3, 8, 8, 1, 2, 3, 4}; int N = 11;

/*
Para cada elemento de A:
-7: last = {-7}
10: last = {-7, 10}
5: last = {-7, 5}, pois é uma LIS de tamanho 2 melhor
2: last = {-7, 2}
3: last = {-7, 2, 3}
8: last = {-7, 2, 3, 8}
8: last = {-7, 2, 3, 8}
1: last = {-7, 1, 3, 8}, pois no futuro a LIS de tamanho 2 {-7, 1} pode ser extendida, mas a melhor LIS atual (não é L) termina em A[6]=8, ou seja, {-7, 2, 3, 8}
2: last = {-7, 1, 2, 8}
3: last = {-7, 1, 2, 3}, melhor LIS atual é {-7, 1, 2, 3}
4: last = {-7, 1, 3, 3, 4}
*/
/* O(N * log(N)) */
int lis0() {
/*
Para cada elemento de A:
-7: last = {-7}
10: last = {-7, 10}
5: last = {-7, 5}, pois é uma LIS de tamanho 2 melhor
2: last = {-7, 2}
3: last = {-7, 2, 3}
8: last = {-7, 2, 3, 8}
8: last = {-7, 2, 3, 8}
1: last = {-7, 1, 3, 8}, pois no futuro a LIS de tamanho 2 {-7, 1} pode ser extendida, mas a melhor LIS atual (não é L) termina em A[6]=8, ou seja, {-7, 2, 3, 8}
2: last = {-7, 1, 2, 8}
3: last = {-7, 1, 2, 3}, melhor LIS atual é {-7, 1, 2, 3}
4: last = {-7, 1, 3, 3, 4}
*/
vector<int> size(N); // size[j] = tamanho da LIS que termina com A[j]
vector<int> last(N+1, INF); // last[s] = último elemento da LIS de tamanho s
last[0] = -INF;
Expand Down
4 changes: 3 additions & 1 deletion scripts/open-problem-statement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ then
fi

# ignore if is no supported
if [[ $JUDGE != "uva" ]] && [[ $JUDGE != "live_archive" ]] && [[ $JUDGE != "codeforces" ]] && [[ $JUDGE != "uri" ]] && [[ $JUDGE != "spoj" ]] && [[ $JUDGE != "timus" ]]
if [[ $JUDGE != "uva" ]] && [[ $JUDGE != "live_archive" ]] && [[ $JUDGE != "codeforces" ]] && [[ $JUDGE != "uri" ]] && [[ $JUDGE != "spoj" ]] && [[ $JUDGE != "timus" ]] && [[ $JUDGE != "kattis" ]]
then
return
fi
Expand All @@ -21,13 +21,15 @@ FILE_codeforces=${FILE/-//}
FILE_uri=${FILE}
FILE_spoj=${FILE}
FILE_timus=${FILE}
FILE_kattis=${FILE}

BASE_URL_uva="https://onlinejudge.org/external/"
BASE_URL_live_archive="https://icpcarchive.ecs.baylor.edu/external/"
BASE_URL_codeforces="https://codeforces.com/problemset/problem/"
BASE_URL_uri="https://www.urionlinejudge.com.br/judge/problems/view/"
BASE_URL_spoj="https://spoj.com/problems/"
BASE_URL_timus="https://acm.timus.ru/problem.aspx?space=1&num="
BASE_URL_kattis="https://open.kattis.com/problems/"

url_judge=BASE_URL_$JUDGE
file_judge=FILE_$JUDGE
Expand Down
Loading

0 comments on commit 8149397

Please sign in to comment.