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
// Stack - Object oriented implementation using arrays | |
#include <iostream> | |
using namespace std; | |
#define MAX_SIZE 101 | |
class Stack | |
{ | |
private: | |
int A[MAX_SIZE]; // array to store the stack | |
int top; // variable to mark the top index of stack. |
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
// Ivan Carvalho | |
// Problem A - Educational Dynamic Programming Contest - AtCoder | |
// Link : https://atcoder.jp/contests/dp | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int MAXN = 1e5 + 10; | |
const int INF = 2*1e9; | |
int dp[MAXN],N,K,h[MAXN]; |
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
int go(int id, int have){ | |
if(have < 0) | |
return -inf; | |
if(id > n) | |
return 0; | |
int ans = -inf; | |
int take = 1 + go(id+1, have - c[id]); | |
int dont_take = go(id + 1, have); | |
ans = max({ans, take, dont_take}); |
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
int dp[MAXN][MAXN]; // assign all to -1 | |
int go(int id, int have){ | |
if(have < 0) | |
return -inf; | |
if(id > n) | |
return 0; | |
int &ans = dp[id][have]; | |
if(ans != -1) |
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
int go(int L, int R){ | |
if(L > R) | |
return 0; | |
if(L == R) | |
return a[L]; | |
int &ans = dp[L][R]; | |
if(ans != -1) | |
return ans; |
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
int mat[N][N], colSum[N], n, m, x, y, dp[N][N][2]; | |
int go(int id, int cx, int prev) { | |
if(cx > y) | |
return inf; | |
if(id > m) | |
return (cx >= x and cx <= y ? 0 : inf); | |
int& ans = dp[id][cx][prev]; | |
if(~ans) |
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
int go(int i, int j) { | |
if (i == n || j == m) return 0; | |
int &ans = dp[i][j]; | |
if (ans != -1) return ans; | |
ans = 0; | |
int c1 = 0; | |
if (s[i] == t[j]) { |
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
void trace(int i, int j) { | |
if (i == n || j == m) return ; | |
int ans = go(i, j); | |
int c1 = 0; | |
if (s[i] == t[j]) { | |
c1 = 1 + go(i + 1, j + 1); | |
if (c1 == ans) { | |
cout << s[i]; |
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
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.294] Code complete: sema context TopLevel, query scopes [] (AnyScope=true), expected type <none>\n" | |
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.295] Code complete: 1 results from Sema, 13 from Index, 0 matched, 0 from identifiers, 14 returned.\n" | |
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.295] --> reply:textDocument/completion(26) 4 ms\n" | |
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.517] <-- textDocument/didChange\n" | |
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.669] <-- textDocument/didChange\n" | |
[ERROR][2021-12-06 20:16:25] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:25.862] <-- textDocument/didChange\n" | |
[ERROR][2021-12-06 20:16:26] .../vim/lsp/rpc.lua:417 "rpc" "clangd" "stderr" "I[20:16:26.192] <-- textDocument/didChange\n" | |
[ERROR] |
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
----------------------------------------------------------- | |
-- Neovim settings | |
----------------------------------------------------------- | |
----------------------------------------------------------- | |
-- Neovim API aliases | |
----------------------------------------------------------- | |
--local map = vim.api.nvim_set_keymap -- set global keymap | |
local cmd = vim.cmd -- execute Vim commands | |
local exec = vim.api.nvim_exec -- execute Vimscript |
OlderNewer