3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

目的

ABC411のD問題にて、解説通りに記述したところTLE。
文字列結合の記述を変えたらACになったため、今後はTLEしないようにメモ。

環境

  • Windows、pycharmでコード作成
  • pypyで提出

内容

こちらの記事を参考にしました。
実際にかかる時間も比較されていてすごい。

遅い

ans=""としてans += "hogehoge~"とする。
最後にansを出力。

速い

ans=[]としてans.append("hogehoge~")としていく。
最後に"".join(ans)を出力。

注;ABC411_D問題では文字列を反転して格納していく必要がありますが、上記では省略しています。

最後に

競技プログラミング面白いです。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?