Loading... # 赛前 ## 头部 **你好,世界!** 本次公告严格仿照LG 这里是**2025年10月FMCRAFT月赛** 众所周知,一张比赛需要一张头图  ## 比赛基本信息 ### 难度 绝对性对标 $CSP-X$ 绝对性简单 小学生都能做出来 我说的是$T1 \space T2 \space T3$ ### 主要人员 本次比赛,工作人员如下: - 负责人:`LG_DHEnry` - 出题人:`LG_DHEnry` `_zjy_` - 验题人:`LG_DHEnry` `_zjy_` 本次比赛,只有两个人员 ### 题目一览 *确信——$CSP-X$* | | A | B | C | D | E | | -------- | ----------------------- | ----------------------- | -------------------------- | ----------------------- | ----------------------------------- | | 当前状态 | 正式试题 | 正式试题 | 正式试题 | 正式试题 | 正式试题 附加题该题疑似TD有误 | | 题目名称 | 小美的垃圾桶 | 小乐百钱买鸡 | 小乐的一生 | 村民打金服 | 选朋友 | | 难度 | 入门 | 入门 | 普及 / 提高− | 普及+ / 提高 | 提高+ / 省选- | | 时间限制 | 1秒 | 1秒 | TF-OJ 10秒LUOGU 1秒 | 1秒 | 2秒 | | 内存限制 | 256MB | 256MB | 256MB | 256MB | 256MB | | 题目类型 | 传统 | 传统 | 传统 | 传统 | 传统 | | 评测标准 | TF-OJ | TF-OJ | TF-OJ | TF-OJ | TF-OJ | | 出题人 | `LG_DHEnry` | `LG_DHEnry` | `_zjy_` | `_zjy_` | `LG_DHEnry` | | 验题人 | `LG_DHEnry` `_zjy_` | `LG_DHEnry` `_zjy_` | `LG_DHEnry` `_zjy_` | `LG_DHEnry` `_zjy_` | `LG_DHEnry` | 空为待补充项目 ### 比赛时间 开始时间 `2025-10-18 12:00` 结束时间 `2025-10-19 12:00` ### 奖励 共计10元 ## 为什么公告要放在我的Blog? 因为此次比赛,将在[比赛1007 - 2025年10月FMCRAFT月赛 - TropicalFish-OnlineJudge](https://oj.www.fmcraft.top/contest.php?cid=1007)、[2025年10月FMCRAFT月赛 - 洛谷 | 计算机科学教育新生态](https://www.luogu.com.cn/contest/281029)和[2025年10月FMCRAFT月赛 - 洛谷 | 计算机科学教育新生态](https://www.luogu.com.cn/contest/281030)同时举行,为防止更新不及时,所以在本Blog进行公告 - TropicalFish-OnlineJudge 没有洛谷账号的人可以在此提交 - 1团比赛 在1团的人可以提交 - 2团比赛 在2团的人可以提交 也许是因为FMCRAFT组织人数膨胀(?) ## 报名比赛 [FMCRAFT - 洛谷 | 计算机科学教育新生态](https://www.luogu.com.cn/team/108134) [FMCRAFT 2团 - 洛谷 | 计算机科学教育新生态](https://www.luogu.com.cn/team/115251) [主页 - TropicalFish-OnlineJudge](https://oj.www.fmcraft.top/) 在这3个地方,我们都将会同时举行比赛,但是!奖励分发标准以[主页 - TropicalFish-OnlineJudge](https://oj.www.fmcraft.top/)为准 ## 重要 因题目E的原因,当我们看到有题目E的提交的时候,我们会进行强制停判,跳过判题,在比赛后,我们会进行重测。关于如何校验自己的答案是否正确,你可以浪费洛谷的评测资源哦。 因测试数据原因,你在洛谷和OJ提交的代码得分可能不同,请以OJ为准。 实际得分与题目数据范围SUBTASK分数可能不符,以实际为准。 # 赛时 # 赛后 ## 排名 | 排名 | 用户 | 昵称 | 解决 | 累计时间 | 得分 | [A](problem.php?cid=1007&pid=0) | [B](problem.php?cid=1007&pid=1) | [C](problem.php?cid=1007&pid=2) | [D](problem.php?cid=1007&pid=3) | [E](problem.php?cid=1007&pid=4) | | ------ | ---------------------------------- | --------------- | ------ | ---------- | ---------------------------------------- | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | | 1 | [admin](https://oj.www.fmcraft.top/userinfo.php?user=admin) | administrator | 1 | 0:26:04 | [100](https://oj.www.fmcraft.top/status.php?user_id=admin&cid=1007) | ※1st100 00:26:04 | | | | | | 2 | [Im\_Aur](https://oj.www.fmcraft.top/userinfo.php?user=Im_Aur) | AuroraRealm | 1 | 1:06:24 | [100](https://oj.www.fmcraft.top/status.php?user_id=Im_Aur&cid=1007) | 100 01:06:24 | | | | | ## 奖金 第一名是Im_aur 奖励10元 ## 遗憾 pika_没有在oj提交 ## std ### 1 ```cpp #include<bits/stdc++.h> #define int long long using namespace std; int n,i,s1,s2,fl,l,j,s;char a[11100000]; main(){ freopen("A.in","r",stdin); freopen("A.out","w",stdout); cin>>n; for(i=1;i<=n;i++){ cin>>a+1;s1=s2=fl=0; l=strlen(a+1); for(j=1;j<=l;j++) if(a[j]=='6'){ s++;fl=1;break; } else{ if(a[j]=='0')s1++; if(a[j]=='1')s2++; } if(s1>s2&&!fl)s++; } cout<<s<<"\\n"<<n-s; } ``` ### 2 ```cpp #include<bits/stdc++.h> #pragma GCC optimize("O2") #define int long long using namespace std; int n,i,s1,s2,fl,l,j,s,m,t,k; main(){ freopen("B.in","r",stdin); freopen("B.out","w",stdout); cin>>m>>n; for(i=0;i<=n;i++){ for(j=0;j<=n;j++){ for(k=0;k<=n/3;k++){ if(i\*5+j\*3+k==m&&i+j+k\*3==n){ cout<<++t<<" "<<i<<" "<<j<<" "<<k\*3<<"\\n"; } } } } if(t==0) cout<<"No!"; } ``` ### 3 ```cpp #include <iostream> #include <vector> #include <queue> using namespace std; vector<int> dirs = {-1, 0, 1, 0, -1}; void dfs(vector<vector<int>>& grid, queue<pair<int, int>>& q, int i, int j, int n, int m) { if (i < 0 || j < 0 || i >= n || j >= m || grid[i][j] != 1) { return; } grid[i][j] = 2; q.push(make\_pair(i, j)); for (int k = 0; k < 4; ++k) { dfs(grid, q, i + dirs[k], j + dirs[k + 1], n, m); } } int shortestBridge(vector<vector<int>>& grid, int n, int m) { queue<pair<int, int>> q; bool found = false; for (int i = 0; i < n && !found; ++i) { for (int j = 0; j < m && !found; ++j) { if (grid[i][j] == 1) { dfs(grid, q, i, j, n, m); found = true; } } } int steps = 0; while (!q.empty()) { int size = q.size(); while (size--) { pair<int, int> current = q.front(); q.pop(); int i = current.first; int j = current.second; for (int k = 0; k < 4; ++k) { int x = i + dirs[k]; int y = j + dirs[k + 1]; if (x >= 0 && y >= 0 && x < n && y < m) { if (grid[x][y] == 1) { return steps; } if (grid[x][y] == 0) { grid[x][y] = 2; q.push(make\_pair(x, y)); } } } } steps++; } return -1; } int main() { freopen("C.in","r",stdin); freopen("C.out","w",stdout); int n, m; cin >> n >> m; vector<vector<int>> grid(n, vector<int>(m)); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> grid[i][j]; } } cout << shortestBridge(grid, n, m) << endl; return 0; } ``` ### 4 ```cpp #include <iostream> #include <vector> #include <queue> #include <algorithm> #pragma GCC optimize("O2") using namespace std; struct Transaction { int b; int c; }; int main() { freopen("D.in","r",stdin); freopen("D.out","w",stdout); ios::sync\_with\_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(n+1); vector<Transaction> trans(n+1); for(int i=1; i<=n; ++i) cin >> a[i]; for(int i=1; i<=n; ++i) cin >> trans[i].b >> trans[i].c; vector<pair<int, int>> operations; int collect\_ops = 0; auto can\_trade = [&](int idx) { return a[idx] >= trans[idx].b; }; priority\_queue<pair<int, int>> pq; // {c, index} for(int i=1; i<=n; ++i) { if(!can\_trade(i)) { pq.push({trans[i].c, i}); } } while(m--) { int op; cin >> op; if(op == 1) { int l, r, x; cin >> l >> r >> x; bool useful = false; for(int i=l; i<=r; ++i) { if(!can\_trade(i)) { useful = true; a[i] += x; if(can\_trade(i)) { // Remove from priority queue if now tradable // (Implementation simplified for clarity) } } } if(useful) collect\_ops++; } else if(op == 2) { int x; cin >> x; if(can\_trade(x)) { a[x] -= trans[x].b; } } } cout << collect\_ops << endl; return 0; } ``` ### 5 ```cpp #include <iostream> using namespace std; // 内联函数减少调用开销,直接使用\_\_int128计算 inline long long mul\_mod(long long a, long long b, long long mod) { return ((\_\_int128)a \* b) % mod; } // 计算排列数 P(n, r) mod mod,极致优化版本 long long permutation(long long n, long long r, long long mod) { if (mod == 1) return 0; if (r >= mod) return 0; // 核心优化:连续mod个数必有倍数 // 快速检查是否存在因子能被mod整除(提前退出循环) long long min\_val = n - r + 1; if (min\_val <= 0) return 0; // 理论上r<=n,这里是防御性判断 // 计算mod的最小质因子上限,用于快速判断 long long limit = min(r, mod - 1); long long result = 1; for (long long i = 0; i < limit; ++i) { long long term = n - i; result = mul\_mod(result, term, mod); if (result == 0) break; // 一旦出现0,直接返回 } return result; } int main() { freopen("E.in","r",stdin); freopen("E.out","w",stdout); ios::sync\_with\_stdio(false); cin.tie(nullptr); int T; long long mod; cin >> T >> mod; // 批量处理输入输出,减少IO开销 while (T--) { long long n, r; cin >> n >> r; cout << permutation(n, r, mod) << '\\n'; } return 0; } ``` 最后修改:2025 年 10 月 19 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 4 如果觉得我的文章对你有用,请随意赞赏
2 条评论
6
6喵