2025.2.15——1400
1.2025.2.19——15002.11.23 周六3.11.24 周日4.11.25 周一日常5.2024.11.26 周二日常6.2024.11.27 周三7.2024.11.28周四8.2024.11.29 周五9.2024.11.30 周六10.2024.12.1 周日11.2024.12.2 周一12.2024.12.3 周二13.2024.12.4 周三14.2024.12.5 周四15.2024.12.7 周六16.2024.12.8 周日17.2024.12.9 周一18.2024.12.10 周二19.2024.12.11 周三20.2024.12.12 周四21.2024.12.13 周五22.2024.12.14 周六23.2024.12.16 周一24.2024.12.17 周二25.2024.12.18 周三26.2024.12.19 周四27.2024.12.20 周五28.2024.12.21 周六29.2024.12.22 周日30.2024.12.23 周一31.2024.12.24 周四32.2024.12.25 周三33.2024.12.26 周四34.2024.12.27 周五35.2024.12.28 周六36.2024.12.29 周日37.2024.12.30 周一38.2025.1.5——120039.2025.1.12——120040.2025.1.14——120041.2025.1.15——120042.2025.1.16——120043.2025.1.17——120044.2025.1.18——130045.2025.1.19——130046.2025.1.20——130047.2025.1.21——130048.2025.1.22——130049.2025.1.24——140050.2025.1.26——140051.2025.2.8——140052.2025.2.9——140053.2025.2.10——140054.2025.2.14——1400
55.2025.2.15——1400
56.2025.2.17——14002025.2.15——1400
A 1400
B 1400
C 1400
------------------------------------------------
-
思维+位运算+思维/数学
A
- 单独对一个数进行分析什么情况下会有贡献。
- 在前面且所有比其小的数,都必须是最小前缀。
- 两个树状数组记录小的个数和最小前缀的个数。遍历维护信息可以做到不使用树状数组(思维点)。
B
- 模拟发现可以获得所有区间异或和。但没有证明只能获得所有区间异或和。
猜一发。 - 数组元素种类最多只有256个,同类相消,前缀异或和最多也只有256种。
C
- 分类讨论+思维
------------------------代码------------------------
A
#include <bits/stdc++.h>
#define int long long //
#define endl '\n' // attention: interactive/debug
#define el cout << endl
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
#define bugv(VEC) \
{ \
for (auto Vec : VEC) \
cout << Vec << ' '; \
el; \
}
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(10);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
int res = 0;
int lim = 1e12, mn = 1e12;
for (int i = 1; i <= n; i++)
{
res += mn < a[i] && a[i] < lim; // 有选择 并且 在合法区间
mn = min(mn, a[i]);
if (mn - a[i])
lim = min(lim, a[i]);
}
cout << res << '\n';
}
// // 树状数组 快速求前缀和
// // 维护差分数组(区间加) 位置(统计个数) ...
// struct Tree
// {
// int n;
// vector<int> tr;
// Tree(int n1)
// {
// n = n1 + 2;
// tr.assign(n + 2, 0);
// }
// void add(int x, int c) // 加点
// {
// for (int i = x; i <= n; i += i & -i)
// tr[i] += c;
// }
// int ask(int x) // 前缀查询
// {
// int res = 0;
// for (int i = x; i; i -= i & -i)
// res += tr[i];
// return res;
// }
// int ask(int l, int r) // 区间查询
// {
// if (l > r)
// return 0ll;
// return ask(r) - ask(l - 1);
// }
// }; // Tree tr(n); tr.add(x,c)
// void _()
// {
// int n;
// cin >> n;
// vector<int> a(n + 1);
// for (int i = 1; i <= n; i++)
// cin >> a[i];
// Tree cnt(n), pre_cnt(n);
// int pre_mn = 1e12;
// int res = 0;
// for (int i = 1; i <= n; i++)
// {
// if (cnt.ask(1, a[i]) && cnt.ask(1, a[i]) == pre_cnt.ask(1, a[i]))
// res++;
// pre_mn = min(pre_mn, a[i]);
// cnt.add(a[i], 1);
// if (pre_mn == a[i])
// pre_cnt.add(a[i], 1);
// }
// cout << res << '\n';
// }
B
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
#define bugv(VEC) \
{ \
for (auto Vec : VEC) \
cout << Vec << ' '; \
cout << '\n'; \
}
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(10);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
// srand(time(0));
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
// a[i] = rand() % 256;
cin >> a[i];
// bugv(a);
set<int> s;
s.insert(0);
int pre = 0, res = 0;
for (int i = 1; i <= n; i++)
{
pre ^= a[i];
for (auto x : s)
{
res = max(res, pre ^ x);
}
s.insert(pre);
}
cout << res << '\n';
}
C
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
#define bugv(VEC) \
{ \
for (auto Vec : VEC) \
cout << Vec << ' '; \
cout << '\n'; \
}
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(10);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
int mx = -20;
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
{
cin >> a[i];
mx = max(mx, a[i]);
}
vector<pair<int, int>> res;
auto add = [&](int i, int j)
{
a[i] += a[j];
res.push_back({i, j});
};
if (mx < 1)
{
for (int i = n - 1; i; i--)
{
add(i, i + 1);
}
}
else
{
int id = 1;
for (int i = 1; i <= n; i++)
{
if (a[i] == mx)
{
id = i;
break;
}
}
int t = 10;
while (t--)
{
add(id, id);
}
add(1, id);
for (int i = 2; i <= n; i++)
{
add(i, i - 1);
add(i, i - 1);
}
}
// bool f = 1;
// for (int i = 2; i <= n; i++)
// {
// if (a[i] - a[i - 1] < 0)
// {
// f = 0;
// }
// }
// bug(f);
cout << res.size() << '\n';
for (auto [i, j] : res)
{
cout << i << ' ' << j << '\n';
}
// bug(20ll << 44);
// bugv(a);
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!