8月5日CSP-S模拟赛赛后总结

\[8月5日 \ \ CSP-S模拟赛 \ \ 赛后总结 \\ 2024年8月5日 \\ by \ \ \ uhw177po
\]

一、做题情况

  • 第一题比赛 \(100pts\) ,赛后 \(AC\)

  • 第二题比赛 \(20pts\) ,赛后 \(AC\)

  • 第三题比赛 \(0(40)pts\) ,赛后 \(AC\)

  • 第四题比赛 \(0(50)pts\) ,赛后 \(AC\)

  • 比赛得分 \(120(210)/400 \ pts\) ,赛后补题 \(400 / 400 \ pts\)

二、比赛概况

等一下说一说我为什么要加括号。

这次键盘感觉不太舒服。

把大数据解压后,打开 pdf 文件,总览一遍,T1竟然一遍没思路,再看T2、T3、T4,更没思路了。只好做T1,仔细看,模拟了一遍,突然想到思路了,这不就是二路归并吗,马上做完 \(AC\)。T2当时脑子混了,模拟没写出,骗了个分,预期 \(20pts\)。T3想了好久也不会,只好骗分 \(40pts\)(部分分给得挺高),T4花了20 min读题,有点读不懂,最终还是模拟样例读懂,写了个暴力,\(50pts\) 完美收场。

(现在说加括号的原因,赛后前15 min正准备收场,结果不幸被 XX 给把文件搞混了,导致T3、T4 \(0pts\) 悲)

三、题解报告

8月5日模拟赛题目

T1:

做法:

上文说了,是 二路归并,其实就是模拟,模拟一下结果就出来了。

附:AC代码

#include <bits/stdc++.h>
#define int long long
using namespace std ;
int n , m , l , r , a [100010] , mp [100010] , b [100010] , c [100010] , tot , cnt ;
signed main () {
ios::sync_with_stdio (false) ;
cin.tie (NULL) ; cout.tie (NULL) ;
freopen ("seq.in" , "r" , stdin) ;
freopen ("seq.out" , "w" , stdout) ;
cin >> n >> m ;
for (int i = 1 ; i <= m ; i ++) cin >> a [i] , mp [a [i]] ++ ;
for (int i = 1 ; i <= n ; i ++)
if (! mp [i]) b [++ tot] = i ;
l = r = 1 ;
while (l <= m && r <= tot) {
while (a [l] < b [r] && l <= m) {
c [++ cnt] = a [l] ;
l ++ ;
}
c [++ cnt] = b [r] ; r ++ ;
}
while (l <= m) c [++ cnt] = a [l ++] ;
while (r <= tot) c [++ cnt] = b [r ++] ;
for (int i = 1 ; i <= cnt ; i ++) cout << c [i] << "\n" ;
return 0 ;
} /*
菜就多练
f**k €€£
€€£梨马4了
5 3
1 4 2 5 3
1 2 5
3 4
1 2 3 4 5
*/

T2:

做法:

没想到也是模拟。自己弄一个栈,判断是' (' 还是 ')' ,进行模拟,就行了。

附:AC代码

#include <bits/stdc++.h>
#define int long long
#pragma G++ optimize (2)
#pragma G++ optimize (3)
using namespace std ;
int n , k , ans , t ;
char a [1000010] ;
signed main () {
ios::sync_with_stdio (false) ;
cin.tie (NULL) ; cout.tie (NULL) ;
freopen ("bracket.in" , "r" , stdin) ;
freopen ("bracket.out" , "w" , stdout) ;
cin >> n >> k >> a + 1 ;
for (int i = 1 ; i <= n ; i ++) {
if (a [i] == '(') {
if (t == k) t -- , ans ++ ;
else t ++ ;
}
else {
if (t == 0) t ++ , ans ++ ;
else t -- ;
}
}
cout << ans ;
return 0 ;
}

T3:

做法:

这道就是 背包 再加一点 贪心,按 \(p_i\) 排列,然后就是一道 背包 了。

附:AC代码

#include <bits/stdc++.h>
#define int long long
#pragma G++ optimize (2)
#pragma G++ optimize (3)
using namespace std ;
const int N = 1e5 + 10 ;
int n , k , ans , dp [N] ;
struct node {
int x , y ;
} a [N] ;
bool cmp (node q , node h) {
return q.y > h.y ;
}
signed main () {
ios::sync_with_stdio (false) ;
cin.tie (NULL) ; cout.tie (NULL) ;
freopen ("work.in" , "r" , stdin) ;
freopen ("work.out" , "w" , stdout) ;
/*
fu*k €€£,€€£梨马4了,money++
*/
cin >> n >> k ;
for (int i = 1 ; i <= n ; i ++) cin >> a [i].x ;
for (int i = 1 ; i <= n ; i ++) cin >> a [i].y ;
sort (a + 1 , a + 1 + n , cmp) ;
memset (dp , 31 , sizeof (dp)) ; dp [0] = 0 ;
for (int i = 1 ; i <= n ; i ++)
for (int j = 2e3 ; j >= 1 ; j --)
dp [j] = min (dp [j] , dp [j - 1] + a [i].x + a [i].y * (j - 1)) ;
for (int i = 2e3 ; i >= 1 ; i --)
if (dp [i] <= k) {
cout << i ; break ;
}
return 0 ;
}

T4:

做法:

观察发现,使得答案非零的结构一定是,一个团外面挂一些点,然后团外的点之间几乎

没有边。

考虑先求出图中的这个团。

每次删度数最小的点 \(x\),直到剩下的点度数都相同即可,可以用set维护。

附:AC代码

#include <bits/stdc++.h>
using namespace std;
int n, deg[200005], tp[200005], m;
bool vis[200005];
vector<int> g[200005];
set<pair<int, int>> s;
signed main()
{
freopen("clique.in", "r", stdin);
freopen("clique.out", "w", stdout);
ios::sync_with_stdio(0), cin.tie(nullptr);
cin >> n >> m;
for (int i = 1, k, t; i <= m; i++)
{
cin >> k >> t;
g[k].push_back(t);
deg[k]++, deg[t]++;
g[t].push_back(k);
}
for (int i = 1; i <= n; i++)
s.insert({tp[i] = deg[i], i});
while (s.begin()->first != prev(s.end())->first)
{
int u = s.begin()->second;
vis[u] = true;
s.erase(s.begin());
for (auto v : g[u])
{
if (vis[v])
cout << 0, exit(0);
s.erase({tp[v], v});
tp[v]--;
s.insert({tp[v], v});
}
}
int ans = 1;
for (auto v : s)
{
if (deg[v.second] == (int)s.size() - 1)
ans++;
int u = v.second;
for (auto vv : g[u])
{
if (!vis[vv])
continue;
if (deg[vv] == s.size())
ans++;
}
for (int i = 1; i <= n; i++)
{
if (vis[i])
if (deg[i] == deg[u])
ans++;
}
}
cout << ans;
}

四、赛后总结

这把还是比较满意的,知道了暴力出奇迹,要拿稳,在这些时间内拿最高的分。

(最后一个晚上,祭)

8月5日CSP-S模拟赛赛后总结的更多相关文章

  1. 纪中21日c组模拟赛

    AWSL  AWSL  AWSL  AWSL AWSL  AWSL  AWSL  AWSL AWSL  AWSL  AWSL  AWSL AWSL  AWSL  AWSL  AWSL 题解传送 T1  ...

  2. 纪中20日c组模拟赛T1 2121. 简单游戏

    T1 2121. 简单游戏 (File IO): input:easy.in output:easy.out 时间限制: 1000 ms  空间限制: 262144 KB  具体限制 Goto Pro ...

  3. 纪中20日c组模拟赛

    赛后感想 多写点东西总是好的,但是在最后,算法就不要改动了(就这样我少了10分) 题解 T1 2121. 简单游戏 T2 2122. 幸运票

  4. 纪中18日c组模拟赛

    T2 GMOJ2127. 电子表格 (File IO): input:excel.in output:excel.out 时间限制: 1000 ms  空间限制: 262144 KB  具体限制   ...

  5. [luogu#2019/03/10模拟赛][LnOI2019]长脖子鹿省选模拟赛赛后总结

    t1-快速多项式变换(FPT) 题解 看到这个\(f(x)=a_0+a_1x+a_2x^2+a_3x^3+ \cdots + a_nx^n\)式子,我们会想到我们学习进制转换中学到的,那么我们就只需要 ...

  6. 【CYH-02】noip2018数论模拟赛:赛后题解

    1.小奔的矩阵 2.大奔的方案 3.小奔与不等四边形 4.小奔的方案 当然本次比赛肯定难度不会仅限于此啦!后续还会--

  7. [OI笔记]NOIP2017前(退役前)模拟赛的总结

    好久没写blog了- 在noip2017前的最后几天,也就是在我可能将要AFO的前几天写点东西吧- 记录这最后几个月打的那些大大小小的模拟赛 一些比赛由于不允许公开所以就没有贴链接跟题面了- 2017 ...

  8. FJoi2017 1月20日模拟赛 恐狼后卫(口糊动规)

    Problem 1 恐狼后卫(wolf.cpp/c/pas) [题目描述] 著名卡牌游戏<石炉传说>中有一张随从牌:恐狼后卫.恐狼后卫的能力是使得相邻随从的攻击力提高. 现在有n张恐狼后卫 ...

  9. 【GDOI2014模拟】JZOJ2020年8月14日提高组 服务器

    [GDOI2014模拟]JZOJ2020年8月14日提高组 服务器 题目 Time and Memory Limits Description 我们需要将一个文件复制到n个服务器上,这些服务器的编号为 ...

  10. 【GDOI2014模拟】JZOJ2020年8月14日T2 网格

    [GDOI2014模拟]JZOJ2020年8月14日T2 网格 题目 Time and Memory Limits Description 某城市的街道呈网格状,左下角坐标为A(0, 0),右上角坐标 ...

随机推荐

  1. ZynqMP PL固件通过U-BOOT从指定位置加载FPGA BIT

    原因 PL固件可能经常修改,而BOOT.BIN和文件系统.内核实际上基本不会变,在一个平台上可以用同一份.如果每次修改都要重新打包PL 固件到BOOT.BIN,操作起来非常麻烦.所以希望PL 的固件可 ...

  2. python的requirements.txt_维护项目依赖包

    pycharm没有类似maven用于管理依赖包的工具,当一个项目在新的环境运行前,需要将对应依赖的包下载回来,如果一个个下载,会出现缺漏或版本号不对应的情况,这个时候可以用requirements.t ...

  3. 【golang】json数据中复杂key的处理

    例1 type Transport struct { Time string Id int } func main() { //将struct的切片包装成json格式 var st []Transpo ...

  4. 【动手学深度学习】第五章笔记:层与块、参数管理、自定义层、读写文件、GPU

    为了更好的阅读体验,请点击这里 由于本章内容比较少且以后很显然会经常回来翻,因此会写得比较详细. 5.1 层和块 事实证明,研究讨论"比单个层大"但"比整个模型小&quo ...

  5. apisix~14在自定义插件中调用proxy_rewrite

    在 Apache APISIX 中,通过 proxy-rewrite 插件来修改上游配置时,需要确保插件的执行顺序和上下文环境正确.你提到在自己的插件中调用 proxy_rewrite.rewrite ...

  6. manim边学边做--MathTex

    上一篇介绍的SingleStringMathTex主要用来显示只有一行的数学公式,对于复杂的数学公式,可以使用MathTex类. MathTex类继承自SingleStringMathTex,在其基础 ...

  7. webdav协议及我的笔记方案(私有部署)

    背景 用markdown用于文章写作,有几年时间了,不是很喜欢折腾,主要就是在电脑上写,用的笔记软件就是typora.由于里面有很多工作相关的,以及个人资料相关的(包含了各种账号.密码啥的),所以不敢 ...

  8. 全国产RK3568J + FPGA的PCIe、FSPI通信实测数据分享!

    测试数据汇总 案例 时钟频率 理论速率 测试结果 FSPI通信案例 150MHz 71.53MB/s 读速率:67.452MB/s 写速率:52.638MB/s PCIe通信案例 100MHz 803 ...

  9. Restful和WebService区别

    简介 Restful是一种架构风格,其核心是面向资源,更简单: 而webService底层SOAP协议,主要核心是面向活动: 两个都是通过web请求调用接口 RESTful是什么 REST就是(REp ...

  10. SpringBoot 日志文件 logback-spring.xml

    日志文件 将logback-spring.xml配置文件,放到:/src/main/resources中 <?xml version="1.0" encoding=" ...