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

刷题记录表

ARC211A

考虑这样一个性质就是在不考虑 \(5\) 的情况下,答案是什么,当且仅当只有一对 \(i\)\(10 - i\) 都存在的,答案才会加 \(1\)

考虑有 \(5\) 的情况就是不能有相邻的,这个也是好说的,然后感觉就做完了。

点击查看代码
//これも運命じゃないか
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define Air
namespace io{inline int read(){int f = 1, t = 0; char ch = getchar();while(ch < '0' || ch > '9'){if(ch == '-') f = -f; ch = getchar();}while(ch >= '0' && ch <= '9'){t = t * 10 + ch - '0'; ch = getchar();}return t * f;}inline void write(int x){if(x < 0){putchar('-'); x = -x;}if(x >= 10){write(x / 10);}putchar(x % 10 + '0');}
}
using namespace io;
int n;
int a[10];
void work(){n = 9;int tot = 0;for(int i = 1; i <= n; i++){a[i] = read();if(i != 5)tot += a[i];}int ans = 0;ans += max(0ll, a[5] - tot - 1);int cnt = 0;for(int i = 1; i <= 4; i++){if(a[i] && a[10 - i]){cnt ++;}else{if(a[i] || a[10 - i]){cnt = -1;}}}if(a[5]){cnt = -1;}if(cnt == 1){ans ++;}cout << ans << '\n';
}
signed main() {
#ifndef Airfreopen(".in","r",stdin);freopen(".out","w",stdout);
#endifios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int TCS = read();while(TCS--){work();}	return 0;
}

ARC211B

神秘构造,我们考虑答案一定 \(\le 1\) 先特判掉 \(x = y\) 可能等于 \(0\) 的情况,然后就这样构造:

\[s1: \ x 个 0,\ y - x 个 1 \]

\[s2: \ z 个 0 \]

\[s3: \ z 个 0 + s1 \]

正确性感觉很显然,然后就没了吧。

点击查看代码
//これも運命じゃないか
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define Air
namespace io{inline int read(){int f = 1, t = 0; char ch = getchar();while(ch < '0' || ch > '9'){if(ch == '-') f = -f; ch = getchar();}while(ch >= '0' && ch <= '9'){t = t * 10 + ch - '0'; ch = getchar();}return t * f;}inline void write(int x){if(x < 0){putchar('-'); x = -x;}if(x >= 10){write(x / 10);}putchar(x % 10 + '0');}
}
using namespace io;
int x, y, z;
void work(){x = read();y = read();z = read();if(x == y){cout << y << ' ';for(int i = 1; i <= y; i++){cout << '0' << ' ';}cout << '\n';cout << z << ' ';for(int i = 1; i <= z; i++){cout << '0' << ' ';}cout << '\n';cout << z << ' ';for(int i = 1; i <= z; i++){cout << '0' << ' ';}cout << '\n';return ;}cout << y << ' ';for(int i = 1; i <= x; i++){cout << '0' << ' ';}for(int i = 1; i <= y - x; i++){cout << '1' << ' ';}cout << '\n';cout << z << ' ';for(int i = 1; i <= z; i++){cout << '0' << ' ';}cout << '\n';cout << y + z << ' ';for(int i = 1; i <= z; i++){cout << '0' << ' ';}for(int i = 1; i <= x; i++){cout << '0' << ' ';}for(int i = 1; i <= y - x; i++){cout << '1' << ' ';}cout << '\n';
}
signed main() {
#ifndef Airfreopen(".in","r",stdin);freopen(".out","w",stdout);
#endifios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int TCS = 1;while(TCS--){work();}	return 0;
}

ARC211C

我们考虑一个事情就是我们肯定不会出现一次消掉有大于等于两个的极长连续段。

之后考虑每一个相邻连续段就是考察他旁边的两个点,然后贪心的看目前能决策的是不是全局最大值,然后就做完了。

点击查看代码
//これも運命じゃないか
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define Air
namespace io{inline int read(){int x; cin >> x; return x;}inline void write(int x){if(x < 0){putchar('-'); x = -x;}if(x >= 10){write(x / 10);}putchar(x % 10 + '0');}
}
using namespace io;
int n;
const int N = 2e5 + 10;
int a[N];
string s;
struct Data{int l, r;
};
vector<Data> dat;
int sum[N];
int totmx = 0;
void work(){n = read();cin >> s;s = ' ' + s + '#';for(int i = 1; i <= n; i++){a[i] = read();}int last = 0;for(int i = 1; i <= n + 1; i++){if(s[i] == '#'){if(i != 1 && s[i - 1] != '#'){dat.push_back({last + 1, i - 1});}last = i;}}int idl = 0, idr = 0;for(int i = 1; i <= n; i++){if(s[i] == '.'){idl = i;break;}}for(int i = n; i >= 1; i--){if(s[i] == '.'){idr = i;break;}}for(int i = idl; i <= idr; i++){totmx = max(totmx, a[i]);}int tot = 0;for(auto y: dat){int maxx = 0;for(int i = y.l; i <= y.r; i++){maxx = max(maxx, a[i]);}for(int i = y.l; i <= y.r; i++){sum[tot] += (a[i] == maxx);}tot ++;} int ans = 0;for(int i = 0; i < dat.size() - 1; i++){int maxx = 0;for(int j = dat[i].l; j <= dat[i + 1].r; j++){maxx = max(maxx, a[j]);}int flag = (maxx == totmx);ans += sum[i] * sum[i + 1] * flag;// cerr << sum[i] * sum[i + 1] << '     ';}cout << ans << '\n';
}
signed main() {
#ifndef Airfreopen(".in","r",stdin);freopen(".out","w",stdout);
#endifios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int TCS = 1;while(TCS--){work();}	return 0;
}

ARC211D

考虑什么时候不合法,一定是断开某条割边后 \(1, 2\) 在同一连通块,然后我们直接大力 \(dfs\) 每次断掉 \(dfs\) 树上的边就是对的。

点击查看代码
//これも運命じゃないか
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define Air
namespace io{inline int read(){int f = 1, t = 0; char ch = getchar();while(ch < '0' || ch > '9'){if(ch == '-') f = -f; ch = getchar();}while(ch >= '0' && ch <= '9'){t = t * 10 + ch - '0'; ch = getchar();}return t * f;}inline void write(int x){if(x < 0){putchar('-'); x = -x;}if(x >= 10){write(x / 10);}putchar(x % 10 + '0');}
}
using namespace io;
int n, m;
const int N = 2e5 + 10;
vector<int>e[N], v[N];
int id[N];
bool flag[N * 3];
int ans[N][2];
bool vis[N][2];
void dfs(int now, int fa, int op){ans[now][op] = fa;vis[now][op] = 1;for(int i = 0; i < e[now].size(); i++){int y = e[now][i], z = v[now][i];if(vis[y][op]) continue;if(flag[z]){continue;}flag[z] = 1;dfs(y, now, op);}
}
signed main() {
#ifndef Airfreopen(".in","r",stdin);freopen(".out","w",stdout);
#endifios::sync_with_stdio(false);cin.tie(0);cout.tie(0);n = read();m = read();for(int i = 1; i <= m; i++){int x = read(), y = read();e[x].push_back(y);e[y].push_back(x);v[x].push_back(i);v[y].push_back(i + m);}memset(ans, -1, sizeof ans);dfs(1, 0, 0);dfs(2, 0, 1);bool flag = 0;for(int i = 1; i <= n; i++){flag |= (ans[i][0] == -1);flag |= (ans[i][1] == -1);}if(flag){cout << "No\n";return 0;}cout << "Yes\n";for(int i = 1; i <= n; i++){if(ans[i][0]){cout << ans[i][0] << ' ';}if(ans[i][1]){cout << ans[i][1] << ' ';}cout << '\n';}return 0;
}
http://www.jsqmd.com/news/60332/

相关文章:

  • CH9121 DNS 说明
  • 手持三维扫描仪十大品牌权威推荐:国产化替代浪潮下的首选指南
  • 【TET出版 | EI检索】第十届清洁能源与发电技术国际学术会议(CEPGT 2025)
  • 2025年靠谱的回旋插入门/口袋插入门厂家最新推荐排行榜
  • 2025年评价高的湿式球磨机使用案例厂家推荐及采购指南
  • 2025年12月大白罐品牌推荐排行榜单深度评测与选购指南
  • pbootcms模板首页如何调用指定栏目的子栏目(PbootCMS模板首页调用指定栏目子栏目的方法)
  • 2025年二氧化碳储气罐实力厂家权威推荐榜单:空气缓冲罐‌/不锈钢储气罐‌/压力储气罐‌源头厂家精选
  • 2025年12月大白罐品牌推荐排行榜:五款产品对比与选购指南
  • Python 接口自动化必看:Token 过期的9种解决方案
  • 2025年优质LED公司推荐及可靠的LED供应厂家分析
  • VNA专用高频测试电缆选型指南:从理论到实践的全方位解析
  • 2025比较出名的留学机构有哪些
  • 2025年热门的粘结钕铁硼塑磁转子/橡胶塑磁厂家最新权威实力榜
  • 2025北京留学中介哪个好
  • pbootcms模板文件如何调用网站所有的文章(PbootCMS模板调用全站文章指南)
  • AI模型评估产品评论中建议的有效性
  • 2025年12月宝宝面霜品牌推荐排行榜单对比与选购指南
  • Rust 基础设施团队专访:CI/CD、供应链安全与增长的挑战
  • 2025年靠谱的引风式空冷器TOP品牌厂家排行榜
  • 2025年热门的弹簧机卷簧机/无凸轮弹簧机厂家最新权威推荐排行榜
  • 2025年中国金属探测仪生产厂排名:看看哪家实力强值得推荐
  • 2025年比较好的线材成型机弹簧机/线材成型机弯线机厂家最新实力排行
  • 2025年靠谱的极薄缓冲骑马抽/侧帮缓冲骑马抽厂家推荐及选购指南
  • 2026年河北石家庄新乐市农村自建房推荐榜,图南建房宝领衔 六家实力公司赋能乡村宜居生活
  • 【IEEE出版 | EI检索】第五届高性能计算、大数据与通信工程国际学术会议(ICHBC 2025)
  • day07 List组件
  • 2025年浙江十大高考复读学校排名:杨府山高复教师专业水平高
  • 2025年12月台球加盟品牌排行榜对比:五个品牌深度评测与推荐指南
  • 2025年知名的亮化照明工程/城市夜景照明工程行业精选榜