This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define MAX_V 40010 | |
// graph by adjacency list |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
int dp[512][512], c[512]; | |
const int INF = 500; | |
int main() { |
This file contains hidden or 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 ABBADiv1: | |
def canObtain(self, initial, target): | |
def dfs(s): | |
if len(s) == len(target): | |
return s == target | |
if s not in target and s not in rev_target: | |
return False | |
return dfs(s + 'A') or dfs((s + 'B')[::-1]) | |
rev_target = target[::-1] | |
return "Possible" if dfs(initial) else "Impossible" |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
int main() { | |
int N, K; cin >> N >> K; | |
vector<int> a(N); | |
for (int i = 0; i < N; i++) cin >> a[i]; |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
struct ApplesAndOrangesEasy { | |
int maximumApples(int N, int K, vector<int> _info) { | |
vector<int> info(N, 0); | |
for (int i : _info) info[i-1] = 1; | |
for (int i = 0; i < N; i++) { | |
int cnt = 0, left = max(0, i-K+1); |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
ll dp[21][21]; | |
int s[40], L, N; | |
ll rec(int x, int y, int bit) { | |
if (x + y == L) return 1; |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
#define REP(i,x) FOR(i,0,x) | |
#define INF 1<<29 | |
template <typename T> | |
struct MaxFlow { | |
struct Edge { |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
typedef pair<int, int> P; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define ALL(c) c.begin(), c.end() | |
struct StronglyConnectedComponents { | |
int V; |
This file contains hidden or 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
#/bin/sh | |
# emacs | |
brew install emacs --with-cocoa --with-ctags --with-d-bus --with-gnutls --with-imagemagick --with-librsvg --with-mailutils | |
brew applinks | |
# brewcask | |
brew install caskroom/cask/brew-cask | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" |
This file contains hidden or 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
(命題) 任意の正の整数iについて、2以上A[i+1]未満の全ての数は、A[1], A[2], ..., A[i]の異なる要素の和で表すことができる。 | |
(証明) | |
数学的帰納法で示す。 | |
(1) i=1,2のとき | |
2はA[1]、3はA[2]なので、示せた。 | |
(2) i=k, k+1のときに、命題が成立すると仮定する。 | |
このとき、i=k+2について、命題(2以上A[k+3]未満の全ての数は、A[1], ..., A[k+2]の異なる要素の和で表すことができる)が成立することを示す。 | |
(2-i) 2 <= x < A[k+2]のとき | |
仮定より、A[1], ..., A[k+1]で表すことができる。 |