当前位置:网站首页>两日总结十
两日总结十
2022-08-11 01:14:00 【JSU-YSJ】
比赛总结:
Educational Codeforces Round 133 (Rated for Div. 2)
D题实在是有些可惜,当时都已经想到了,就是时间卡了一点点,不用队列就直接过了,直接求出K的最大值632,然后就是直接暴力就好了。。。一开始想的有点复杂。
#include <bits/stdc++.h>
#define OST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl "\n"
#define ll long long
#define pair pair<ll, ll>
using namespace std;
const int mod = 998244353;
int vis[200005];
void solve() {
int n, k;
cin >> n >> k;
vector<ll> f(n + 1, 0), ff(n + 1, 0), fff(n + 1, 0);
queue<pair> q;
for (int i = k; i <= n; i += k) {
q.push({i, k + 1});
f[i] = 1;
}
while (!q.empty()) {
auto x = q.front();
q.pop();
if (x.second >= 633) break;
if (x.second > k) {
fff = ff;
ff = f;
k = x.second;
for (int i = 1; i <= n; i++) vis[i] = 0;
}
for (int i = x.first + x.second; i <= n; i += x.second) {
f[i] += (ff[x.first] - fff[x.first] + mod) % mod;
f[i] %= mod;
if (!vis[i]) q.push({i, x.second + 1}), vis[i] = 1;
}
}
for (int i = 1; i <= n; i++) { cout << f[i] << " "; }
cout << endl;
}
signed main() {
int T = 1;
// cin >> T;
OST;
while (T--) { solve(); }
return 0;
}
后面改的代码AC:
#include <bits/stdc++.h>
#define OST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl "\n"
#define ll long long
#define pair pair<ll, ll>
using namespace std;
const int mod = 998244353;
void solve() {
int n, k;
cin >> n >> k;
vector<ll> f(n + 1, 0), ff(n + 1, 0), ans(n + 1, 0);
f[0] = 1;
ll sum = 0;
for (int step = 0; step < 633; step++) {
sum += step;
if (sum > n) break;
for (int j = 0; j + k + step <= n; j++) { ff[j + k + step] = f[j] + ff[j], ff[j] %= mod; }
for (int j = 0; j <= n; j++) f[j] = ff[j], ff[j] = 0, ans[j] += f[j], ans[j] %= mod;
}
for (int i = 1; i <= n; i++) cout << ans[i] << endl;
cout << endl;
}
signed main() {
int T = 1;
// cin >> T;
OST;
while (T--) { solve(); }
return 0;
}
真的难受!!!
然后就是那个C题:想到很简单主要是划分值比较复杂,和容易错,而且在那个位置划分也要考虑,是真的难写。。。。
#include <bits/stdc++.h>
#define OST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl "\n"
using namespace std;
#define ll long long
const int N = 2e5 + 5;
const ll inf = 0x3f3f3f3f3f3f3f3f;
ll t[N][2], f[N][2], houjia[N][2], houjian[N][2];
void solve() {
int n;
cin >> n;
for (int i = 0; i <= 1; i++)
for (int j = 0; j < n; j++) cin >> t[j][i], t[j][i]++;
t[0][0]--;
for (int i = 0; i < 2; i++) {
houjia[n][i] = -inf;
houjian[n][i] = -inf;
for (int j = n - 1; j >= 0; j--) {
houjia[j][i] = max(houjia[j + 1][i] + 1, t[j][i]);
houjian[j][i] = max(houjian[j + 1][i] - 1, t[j][i]);
}
}
ll step = 0, res = inf, ans = inf, ma = 0, flag = 0;
for (int i = 0; i < n; i++) {
ma = max(t[i][flag] - step, ma);
res = max({ma, houjian[i][flag] - step, houjia[i][flag ^ 1] - (step + 2 * (n - i - 1) + 1)});
ans = min(res, ans);
// cout << houjian[flag][i] - step << "--" << step << endl;
step++;
flag ^= 1;
ma = max(t[i][flag] - step, ma);
res = max({ma, houjian[i][flag] - step, houjia[i + 1][flag ^ 1] - (step + 2 * (n - i - 1))});
ans = min(ans, res);
step++;
}
cout << 2 * n - 1 + max(0ll, ans) << endl;
}
signed main() {
int T = 1;
cin >> T;
while (T--) { solve(); }
return 0;
}
航电杯6
其他的1600CF练习题目:
边栏推荐
- 数据分析面试手册《SQL篇》
- leetcode 前K个高频单词
- 【HFSS学习记录1】实例:宽带非对称多节定向耦合器设计
- 双机热备综合实验(VRRP+OSPF+VTP+NAT+DHCP+PVSTP+单臂路由)
- Sub-database sub-table ShardingSphere-JDBC notes arrangement
- How to convert url to obj or obj to url
- Sigma development pays attention to details
- Dual machine thermal for comprehensive experiment (VRRP + OSPF + + NAT + DHCP + VTP PVSTP + single-arm routing)
- 云原生-VMware虚拟机安装Kubesphere实战(一)
- what is an array
猜你喜欢
池化技术有多牛?来,告诉你阿里的Druid为啥如此牛逼!
详谈二叉搜索树
编程技巧│selenium 更新 chromedriver 驱动
【服务器数据恢复】raid5崩溃导致lvm信息和VXFS文件系统损坏的数据恢复案例
MySQL indexes and transactions
【视频】报告分享|2021年保险行业数字化洞察
rhel7.0解决yum无法使用(system is not registered to Red Hat Subscription Management)
R语言多元线性回归、ARIMA分析美国不同候选人对经济GDP时间序列影响
How to easily obtain the citation format of references?
简陋的nuxt3学习笔记
随机推荐
R语言多元线性回归、ARIMA分析美国不同候选人对经济GDP时间序列影响
分库分表ShardingSphere-JDBC笔记整理
22、库存服务
微服务概念
微信小程序自定义navigationBar
详谈二叉搜索树
SQL statement--get database table information, table name, column name, description comment, etc.
简陋的nuxt3学习笔记
More parameter exposure of Pico 4: Pancake + color perspective, and Pro version
BEVDepth: Acquisition of Reliable Depth for Multi-view 3D Object Detection 论文笔记
力扣------用栈操作构建数组
详解JDBC的实现与优化(万字详解)
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monocular Object Pose Est...
C # - delegate detailed usage
Sigma开发注意细节
How to do patent mining, the key is to find patent points, in fact, it is not too difficult
构建资源的弹性伸缩
How to easily obtain the citation format of references?
leetcode 前K个高频单词
成功解决raise TypeError(‘Unexpected feature_names type‘)TypeError: Unexpected feature_names type