当前位置: 首页 > news >正文

2025-11-24

CF

构造(1300)

Problem - 1889A - Codeforces

#include <bits/stdc++.h>
using namespace std;
#define LL long long
const LL mod = 998244353;
const int N=2e5+10;void add(string &s,int x){//在第 x个字符前加入s = s.substr(0, x) + "01" +s.substr(x);
}void solve()
{int n;cin >> n;string s;cin >> s;vector<int> cnt(2);for (int i = 0; i < n;i++){cnt[s[i] - '0']++;}if(cnt[0]!=cnt[1]){cout << -1 << endl;return;}vector<int> a;for (int i = 0; i < s.size();i++){int t = s.size() - i - 1;if(s[i]!=s[t])continue;if(s[i]=='0'){add(s, t + 1);a.push_back(t + 1);}else{add(s, i);a.push_back(i);}if(a.size()>300)break;}if(a.size()>300){cout << -1 << endl;return;}cout << a.size() << endl;for (int i = 0; i < a.size();i++){cout << a[i] << " ";}cout << endl;
}int main()
{ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int T;cin >> T;while (T--){solve();}
}

Problem - 1882B - Codeforces(bitset)

#include <bits/stdc++.h>
using namespace std;
#define LL long long
const LL mod = 998244353;
const int N=55;
bitset<N> s[N], U;void solve()
{int n;cin >> n;U.reset();//清零for (int i = 1; i <= n;i++){s[i].reset();}for (int i = 1; i <= n;i++){int k;cin >> k;for (int j = 1; j <= k;j++){int x;cin >> x;s[i][x] = 1;}U |= s[i];}int ans = 0;for (int i = 1; i <= 50;i++){if(U[i]==0)continue;bitset<N> now;for (int j = 1; j <= n;j++){//遍历每个集合if(s[j][i]==0)now |= s[j];}ans = max(ans, (int)now.count());}cout << ans << endl;
}int main()
{ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int T;cin >> T;while (T--){solve();}
}

Problem - 1868A - Codeforces

#include <bits/stdc++.h>
using namespace std;
#define LL long long
const LL mod = 998244353;
const int N=2e5+10;void solve()
{int n,m;cin >> n >> m;vector<vector<int>> a(n, vector<int>(m));for (int i = 0; i < min(m - 1, n);i++){for (int j = 0; j < m;j++){a[i][(i + j) % m] = j;}}for (int i = m - 1; i < n;i++){for (int j = 0; j < m;j++){a[i][j] = j;}}if (n<m){cout << n + 1 << endl;}else if(m==1){cout << 0 << endl;}else{cout << m << endl;}for (int i = 0; i < n;i++){for (int j = 0; j < m;j++){cout << a[i][j] << " ";}cout << endl;}
}int main()
{ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int T;cin >> T;while (T--){solve();}
}
http://www.jsqmd.com/news/49670/

相关文章:

  • NewStarCTF2024 Week4 Pwn MakeHero
  • 噬菌体筛选:纳米抗体阳性克隆富集的核心实验技术
  • 2025年11月GEO优化公司推荐热度榜:基于十大性能指标的结果承诺保障方案
  • 2025年11月GEO服务商推荐选择指南:专业分析维度助力企业的精准决策
  • SQL-leetcode—3475. DNA 模式识别 - 详解
  • 「张张讲AI」AI资讯公众号:联动深圳人才集团,讲师输出资讯+授课,助力AI落地
  • 使用frp实现内网穿透
  • 2025年11月GEO优化公司推荐权威榜单:十大品牌核心价值与解决方案解析
  • 2025年11月GEO公司推荐选择指南:专业分析维度助力企业精准决策
  • 2025年11月GEO服务商推荐评测报告:从稳定性到AI能力解决方案剖析
  • 2025年11月GEO优化服务商推荐评测报告:从技术实力到实战成果的解决方案剖析
  • macOS怎么关闭指定软件的开机自启
  • WPF的四种曲线绘制
  • 2025年11月北京陪诊公司推荐榜:专业机构服务对比与选择指南
  • 2025年11月北京陪诊公司推荐榜:专业服务对比与用户口碑分析
  • 2025.11.24 - A
  • Codeforces 1473E Minimum Path 题解 [ 蓝 ] [ 分层图最短路 ] [ 贪心 ] [ 构造 ]
  • AI医疗应用研究项目获奖公布
  • 11.24每日总结
  • 别让你的SQL跑了一整晚,最后只产出一堆数字垃圾
  • 二分图边着色学习笔记
  • 2025年11月四川软电线/硬芯线/家装电线/铝合金电缆/铝芯电缆/铜芯/高压/中压/低压电线电缆供应厂家综合推荐指南:五大优质厂商深度解析
  • Windwos11终端的作用
  • 2025龙门多片锯厂家有哪些?
  • 2025防爆空调品牌厂家推荐:守护危险环境的安全温控选择
  • 2025空调噪声治理厂家精选
  • 2025精选起重机厂家推荐
  • 2025.11.24模拟赛
  • 热流道厂家品牌有哪些?2025热流道技术哪家强?
  • 2025安全生产目视化管理公司有哪些:优质目视化管理机构推荐