はまやんはまやんはまやん

hamayanhamayan's blog

2020-03-01から1ヶ月間の記事一覧

Many Powers [灘校75回生中学卒業記念コンテスト]

https://www.hackerrank.com/contests/75th/challenges/many-powers 解説 https://www.hackerrank.com/contests/75th/challenges/many-powers/submissions/code/1321980113 今回の問題の弱点はCが小さいことである。 例えば、(13 + 23 + 33 + 43 + 53 + 63 +…

GCD Products easy [灘校75回生中学卒業記念コンテスト]

https://www.hackerrank.com/contests/75th/challenges/gcd-product-easy 解説 https://www.hackerrank.com/contests/75th/challenges/gcd-product-easy/submissions/code/1321979648 制約を見てみると、iは全探索ができる。 A=1, B=10, N=6が最大であるが、…

Strange Bowling [灘校75回生中学卒業記念コンテスト]

https://www.hackerrank.com/contests/75th/challenges/bowling-3 前提知識 動的計画法 解説 https://www.hackerrank.com/contests/75th/challenges/bowling-3/submissions/code/1321979905 特殊ルールとして、前のターンでA[i]ピッタリ倒すと次のターンは点…

uniform linear sushi [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/uniform-linear-sushi 前提知識 区間スケジューリング問題 解説 https://www.hackerrank.com/contests/oyamac/challenges/uniform-linear-sushi/submissions/code/1321978723 ある寿司を食べている時…

uniform linear sushi 2 [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/uniform-linear-sushi-2 解説 https://www.hackerrank.com/contests/oyamac/challenges/uniform-linear-sushi-2/submissions/code/1321978912 前の問題同様に貪欲法で解ける。 2人の空き時間をcu1, c…

tiktak [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/tiktak-1 解説 https://www.hackerrank.com/contests/oyamac/challenges/tiktak-1/submissions/code/1321978529 順番に60のあまりを取って60で割るというのを繰り返して答えを求めていく方法でACした…

sumsumsum [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/sumsumsum 解説 https://www.hackerrank.com/contests/oyamac/challenges/sumsumsum/submissions/code/1321978637 まずは全探索を考えてみよう。 ABCDxyzは全部整数でなので、等式になるためにはxyz…

storage [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/storage 前提知識 bitsetによる動的計画法高速化 解説 https://www.hackerrank.com/contests/oyamac/challenges/storage/submissions/code/1321979183 見た目、ナップサック問題に近いし、yes/no系動…

rot and rot [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/rot-and-rot 前提知識 行列累乗 解説 https://www.hackerrank.com/contests/oyamac/challenges/rot-and-rot/submissions/code/1321979239 今回の操作はxにコマがあるとすると、A(A+1)x+Bによって次の…

fizzbuzz [OyamaC]

https://www.hackerrank.com/contests/oyamac/challenges/fizzbuzz-20 解説 https://www.hackerrank.com/contests/oyamac/challenges/fizzbuzz-20/submissions/code/1321978445 有名なFizzBuzz問題。 なんとも愚直に解いてしまった。 yukicoderのFizzBuzz問…

荷物収集 [yukicoder 1012]

https://yukicoder.me/problems/no/1012 解説 https://yukicoder.me/submissions/447483 クエリ問題であるが、今回は各クエリを高速に計算していく方針で考える。 O(1)かO(logN)くらいを目指そう。 まず、絶対値を含む問題でよくある方針として、絶対値を外…

competitive fighting [yukicoder 1014]

https://yukicoder.me/problems/no/1014 解説 https://yukicoder.me/submissions/447568 技xから技yへコンボがつなげられる関係を有向辺として考えることにする。 すると、N頂点の有向グラフが形成できる。 このグラフをもとにアルゴリズムを考える。 まずは…

〇マス進む [yukicoder 1013]

https://yukicoder.me/problems/no/1013 前提知識 ダブリング 解説 https://yukicoder.me/submissions/447484 ダブリングを知らないと、この発想は難しいかもしれない。 知らない場合は、検索して学んできてほしい。 「K回行動を行ってどの要素に移動してい…

Infinite Stairs [yukicoder 1011]

https://yukicoder.me/problems/no/1011 前提知識 累積和を用いた動的計画法高速化 解説 https://yukicoder.me/submissions/447477 109+7数え上げ、かつ、既視感のある問題なので、DP解法から考え始める。 すると、以下のDPなら解けることが分かる。 dp[turn…

折って重ねて [yukicoder 1010]

https://yukicoder.me/problems/no/1010 解説 https://yukicoder.me/submissions/447470 完全に雰囲気で解いてしまったので、あまり参考にならないかもしれない。 この問題は貪欲法で解ける。 貪欲は「縦と横で長さが小さい方から折れるまで折って、その後、…

面積の求め方 [yukicoder 1009]

https://yukicoder.me/problems/no/1009 解説 https://yukicoder.me/submissions/447469 ヒントとして書かれている区分求積法を実装することで答えた。 座標が微妙にずれている気もするが、誤差の範囲に収まってくれるだろう。 104くらいの分割でよさそうだ…

Secret Agents [AngstromCTF 2020]

https://ctftime.org/task/10751 日本語は下 Writeup in English If you press lemme get in ... It will be stopped. Let's take a look at the given code. Looking at the login section, you can get a lot of information. @app.route("/login") def lo…

Git Good [AngstromCTF 2020]

https://ctftime.org/task/10758 日本語は下 Writeup in English Required Knowledge Git Writeup This only comes out. Even if you look at the HTTP response, there is only information about what you are doing with Express + nginx. And because it…

Consolation [AngstromCTF 2020]

https://ctftime.org/task/10757 日本語は下 Writeup in English This is a system that increases money by pressing pay me some money. Looking at the source code, it refers to iftenmillionfireflies.js, so take a look at the code. Obfuscation! G…

Xmas Still Stands [AngstromCTF 2020]

https://ctftime.org/task/10756 日本語は下 Writeup in English At the beginning The following information can be obtained by patrolling the page. You can post any string on the /post page After posting, you will be given a number to display …

The Magic Word [AngstromCTF 2020 Web]

https://ctftime.org/task/10755 日本語は下 Writeup in English Start from this screen. First, let's take a look at the source code, as there are no hints. <div> <div class="flexmagic"> <p id="magic">give flag</p> </div> </div> <div> <p class="hidden">you passed it chief</p> </div> <script> var msg = docume…

Japan Tech News #011 2020/03/18

hamayanhamayanがインターネットを巡回して得た情報まとめ。 "Japan"と言うには主語が大きすぎる。 Hottest バッチ処理にバインド変数はもうやめません? ~|バッチ処理の突発遅延を題材にして考えてみる~ なるほど!これは面白い。 最初からこういうのを意識…

Welcome to Earch [b01lersCTF 2020]

https://ctftime.org/task/10704 日本語は下 Writeup in English The problem reminded me of "labyrinth" (Japanese Funny Website) Where do you escape? Anyway, look at the source code. The following javascript code is embedded. document.onkeydow…

Japan Tech News #010 2020/03/15

hamayanhamayanがインターネットを巡回して得た情報まとめ。 "Japan"と言うには主語が大きすぎる。 Hottest @hamayanhamayan • Instagram写真と動画 精進2日目「ぴよんぴよん」 CSSアニメ勉強用にInstagram開設しました!フォローお願いします! 競技プログ…

Three Substrings [パナソニックプログラミングコンテスト2020 E]

https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_e 解説 https://atcoder.jp/contests/panasonic2020/submissions/10896927 どこから考えるべきかであるが、自分はDPから考え始めてしまった。 既視感のある問題だし、自然かなとも思うが、こ…

String Equivalence [パナソニックプログラミングコンテスト2020 D]

https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d 前提知識 枝刈り全探索 (ちょっと違う気もするけど、感覚は似ている) 解説 https://atcoder.jp/contests/panasonic2020/submissions/10896021 問題の定義が少し複雑に感じるかもしれない…

Sqrt Inequality [パナソニックプログラミングコンテスト2020 C]

https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c 解説 https://atcoder.jp/contests/panasonic2020/submissions/10895357 sqrt(a) + sqrt(b) < sqrt(c)を普通に比較することでも通すことができる。 B問題でWAをもらってこの解法に警戒した…

Bishop [パナソニックプログラミングコンテスト2020 B]

https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_b 問題文をみると、半分くらいのマスは移動できそうな感じがある。 なので、HW/2をベースに考えていこう。 小さいケースで見てみると、HWが奇数なら答えが1つ増える。 切り捨て分が答えにな…

Kth Term [パナソニックプログラミングコンテスト2020 A]

https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_a 解説 https://atcoder.jp/contests/panasonic2020/submissions/10894083 数列が与えられるので、それをプログラム内に取り込んで、K番目を答える。 C++ならそのまま{}に入れて突っ込める。…

apt-get updateでRelease file is not yet valid

DockerFileにapt-get update書いて実行したら、途中でエラーが出て止まってしまった。 俺はただgitを入れたかっただけなんだ… RUN apt-get update && apt-get install -y git これをすると E: Release file for http://security.ubuntu.com/ubuntu/dists/bio…