【CodeForces】Codeforces Round 625
比赛链接 点击打开链接 官方题解 点击打开链接 Problem A. Journey Planning 显然可以枚举 b i b_i b i 与 i i i 的差值,并选取所有合法的 b i b_i b i 。 时间复杂度 O ( N L o g N ) O(NLogN) O ( N L o g N ) 。 #include<bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5; typedef long long ll; template <typename T> void chkmax(T &x, T y) {x = max(x, y); } template <typename T> void chkmin(T &x, T y) {x = min(x, y); } template <typename T> void read(T &x) { x = 0; int f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = -f; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; x *= f; } map <int, ll> sum;