文章目录
感想A. Forbidden Integer1.题目内容2.个人思路3.代码
B. Come Together1.题目内容2.个人思路3.代码
C. Strong Password1.题目内容2.个人思路3.代码
D - Rating System1.题目内容2.个人思路3.代码
其他想法
感想
不会写,写的好墨迹
A. Forbidden Integer
1.题目内容
题目地址
2.个人思路
如果1可用就全堆1,否则如果是偶数就全堆2,是奇数就全堆2加一个3 判断一下k能不能取到2和3就可以。
3.代码
int main() {
cin >> t;
while (t--) {
ll k, x;
cin >> n >> k >> x;
vector ans;
if (x != 1) {
cout
if (n % 2 == 0) {
if (k
cout
if (k
cout
cin >> t;
while (t--) {
ll x, y;
cin >> x >> y;
ll a, b, c, d;
cin >> a >> b;
cin >> c >> d;
ll bx = (x - a), by = (y - b);
ll cx = (x - c), cy = (y - d);
if (bx * cx
cout
cout
string s;
cin >> s;
n = s.size();
cin >> m;
string l, r;
cin >> l >> r;
for (int i = 0; i
ll tmp = s[i] - '0';
pos[tmp].insert(i);
}
bool ans = false;
ll ma = -1, mp = -1, now = -1;
for (int i = 0; i
auto x = pos[j].upper_bound(now);
if (x == pos[j].end()) {
ans = true;
break;
}
if (*x > ma) {
ma = *x;
mp = j;
}
}
if (ans) break;
now = ma;
}
if (ans) {
cout
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i
while (!sto.empty() && sum[sto.top()] > sum[i]) {
low[sto.top()] = i;
sto.pop();
}
sto.push(i);
}
for (int i = n; i > 0; i--) {
if (arr[i] > 0) {
dp[i] = -1;
}
else {
if (low[i]) {
dp[i] = dp[low[i]] - sum[low[i] - 1] + sum[i - 1];
}
else dp[i] = abs(arr[i]);
}
}
for (int i = 1; i
nn = dp[i];
k = sum[i - 1];
}
}
cout |