#include #include #include #include #include #include using namespace std; static const int INF = 1e9; struct Dinic { struct E { //to,容量,逆辺のindex int to, cap, rev; E(int t, int c, int r) { to = t; cap = c; rev = r; } }; //最大頂点数 int MAX_V; vector>G; Dinic(int max_v) { MAX_V = max_v; G.resize(MAX_V); } //有向辺 inline void add_edge(int from, int to, int cap) { if (from == to)return; G[from].push_back(E(to, cap, G[to].size())); G[to].push_back(E(from, 0, G[from].size()-1)); } //無向辺 inline void add_undirected_edge(int from, int to, int cap) { if (from == to)return; G[from].push_back(E(to, cap, G[to].size())); G[to].push_back(E(from, cap, G[from].size()-1)); } //深さ vectorlevel; //深さのラベル付け void bfs(int s) { level.assign(MAX_V, -1); queue que; level[s] = 0; que.push(s); while (!que.empty()) { int v = que.front(); que.pop(); for (int i = 0; i < G[v].size(); i++) { E &e = G[v][i]; if (e.cap > 0 && level[e.to] < 0) { level[e.to] = level[v] + 1; que.push(e.to); } } } } //s -- v -- u -- t //tから深さ優先探索 int dfs(int s, int u, int crr) { if (s == u || crr == 0)return crr; int sum = 0; for (int i = 0; i < G[u].size(); i++) { E& e = G[u][i]; //u - v int v = e.to; E& ee = G[v][e.rev]; //v - u if (level[v] >= level[u] || ee.cap <= 0)continue; int f = dfs(s, v, min(crr - sum, ee.cap)); if (f <= 0)continue; //容量の更新 ee.cap -= f; e.cap += f; //流量の更新 sum += f; if (sum == crr)break; } return sum; } int max_flow(int s, int t) { int flow = 0; //tに流せなくなるまで while(1){ bfs(s); if (level[t] < 0)return flow; flow += dfs(s, t, INF); } } }; int main() { int W;cin>>W; int N;cin>>N; Dinic dnc(102); for(int i=0;i>J; dnc.add_edge(0,i+1,J); } int M;cin>>M; for(int i=0;i>C; dnc.add_edge(N+i+1,N+M+1,C); } for(int i=0;i>Q; int x=1; for(int j=0;j>X; for(;x=W ? "SHIROBAKO" : "BANSAKUTSUKITA") << endl; return 0; }