{"provider_name":"Hatena Blog","url":"https://par.hateblo.jp/entry/2017/04/11/174743","published":"2017-04-11 17:47:43","height":"190","author_url":"https://blog.hatena.ne.jp/parukii/","version":"1.0","width":"100%","blog_url":"https://par.hateblo.jp/","title":"\u914d\u5217\u306eswap\u3068vector\u306eswap","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpar.hateblo.jp%2Fentry%2F2017%2F04%2F11%2F174743\" title=\"\u914d\u5217\u306eswap\u3068vector\u306eswap - paruki\u306e\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_url":"https://hatena.blog","author_name":"parukii","description":"vector\u306eswap vector<int> a(N), b(N); swap(a, b); \u3053\u306eswap\u306e\u5b9f\u4f53\u306fvector::swap\u3067swap(a,b)\u306fO(1)\u3067\u7d42\u308f\u308b\u3002DP\u3067\u30e1\u30e2\u30ea\u3092\u7bc0\u7d04\u3059\u308b\u306e\u306b\u3088\u304f\u3084\u308b\u3002 \u914d\u5217\u306eswap int a[N] = {}, b[N] = {}; swap(a, b); \u5148\u7a0b\u306e\u30b3\u30fc\u30c9\u3092\u914d\u5217\u306b\u5909\u3048\u305f\u3060\u3051\u3002\u5b9f\u306f\u3053\u3061\u3089\u306eswap(a,b)\u306b\u306fO(N)\u304b\u304b\u308b\u3002 \u3053\u306e\u8981\u7d20\u6570\u304c\u7b49\u3057\u3044\u914d\u5217\u306eswap(a,b)\u306f\u914d\u5217\u306e\u5404\u5024\u3092\u4ea4\u63db\u3057\u3066\u3044\u308b\u3002 \u3061\u306a\u307f\u306b int a[N] = {}, b[N+1] ={}; swap(a, b); \u306e\u3088\u3046\u306b\u30012\u500b\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u7570\u306a\u308b\u5834\u5408\u3001\u30b3\u30f3\u2026","categories":["C++"],"type":"rich","image_url":null,"blog_title":"paruki\u306e\u30d6\u30ed\u30b0"}