9.10
TchongS1010C · · 个人记录
20260910
一、比赛基本情况
- 比赛日期:
2026.9.10 - 比赛时长:
14:10 至15:40 ,1.5 个小时 - 比赛得分:
95+100+0+100=295 - 比赛排名:
2 二、比赛整体回顾
A\to D\to B\to C A
细节题,光速解决然后踩在细节上
草B
刚开始把题目看错了,然后看对题目后快速解决
C
不会写了个暴力
D
简单题,快速写完
-
-
-
三、题目复盘
A CF934B
-
-
- 本题得分:
95 初始思路
很明显我们想要位数尽可能短我们就要多用圈多的数
8 ,但是如果k>36 ,那么18 个8 也只有36 个圈,所以无解,剩下的我们尽量凑8 ,如果还剩下1 个就输出0,4,6,9 复杂度
- 时间复杂度:
O(1) - 空间复杂度:
O(1) 考场解题过程
光速写完
考场代码
#include <bits/stdc++.h> using namespace std ; long long k , cnt ; int main() { freopen("as01.in" , "r" , stdin) ; freopen("as01.out" , "w" , stdout) ; ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ; cin >> k ; if(k > 36) { cout << -1 ; return 0 ; } while(cnt < k) { if(k - cnt >= 2) { cout << 8 ; cnt += 2 ; } else { cout << 0 ; cnt ++ ; } } return 0 ; }赛后题解
k=1$时不能输出$0 补题代码
#include <bits/stdc++.h> using namespace std ; long long k , cnt ; int main() { ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ; cin >> k ; if(k > 36) { cout << -1 ; return 0 ; } while(cnt < k) { if(k - cnt >= 2) { cout << 8 ; cnt += 2 ; } else { cout << 9 ; cnt ++ ; } } return 0 ; }复杂度
- 时间复杂度:
O(1) - 空间复杂度:
O(1) 题目总结
B CF2007B
- 本题得分:
100 初始思路
~~好的也是一眼查分好吧
?怎么是值域符合范围?
咳咳你应该装作什么都没听到~~
设原始的最大值为
可得
复杂度
- 时间复杂度:
O(n+m) - 空间复杂度:
O(n+m) 考场解题过程
考场代码
#include <bits/stdc++.h> using namespace std ; long long t , n , m , a[100005] , maxn , l , r ; char op ; int main() { freopen("as02.in" , "r" , stdin) ; freopen("as02.out" , "w" , stdout) ; ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ; for(cin >> t ; t -- ;) { cin >> n >> m ; maxn = -8e18 ; for(int i = 1 ; i <= n ; i ++) { cin >> a[i] ; maxn = max(maxn , a[i]) ; } while(m --) { cin >> op >> l >> r ; if(op == '+' && l <= maxn && maxn <= r) { maxn ++ ; } else if(op == '-' && l <= maxn && maxn <= r) { maxn -- ; } cout << maxn << " " ; } cout << "\n" ; } return 0 ; }
#### 赛后题解
我是对的
#### 赛后代码
```cpp line-numbers
我是对的
复杂度
- 时间复杂度:
O(n+m) - 空间复杂度:
O(n+m) 题目总结
C CF2092B
- 本题得分:
40 初始思路
我们都知道
a_i 和b_{i-1},b_{i+1} 有关,如果他们仨都是1 那就没招了,尽可能要让b_{i+1}=0 ,然后模拟复杂度
- 时间复杂度:
O(n) - 空间复杂度:
O(n) 赛场做题过程
自我感觉良好
赛场代码
#include <bits/stdc++.h> using namespace std ; int t , n ; string a , b ; void work() { cin >> n >> a >> b ; if(a[0] == '1' && b[1] == '1') { cout << "NO\n" ; return ; } else if(a[0] == '1') { swap(a[0] , b[1]) ; } for(int i = 1 ; i < a.size() - 1 ; i ++) { if(a[i] == '0') { if(b[i + 1] == '1') { swap(b[i + 1] , b[i - 1]) ; } continue ; } if(b[i - 1] == '1' && b[i + 1] == '1') { cout << "NO" ; return ; } else if(b[i - 1] == '1') { swap(a[i] , b[i + 1]) ; } else { swap(a[i] , b[i - 1]) ; } } if(a[a.size() - 1] == '1' && b[a.size() - 2] == '1') { cout << "NO\n" ; } cout << "YES\n" ; } int main() { freopen("as03.in" , "r" , stdin) ; freopen("as03.out" , "w" , stdout) ; ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ; for(cin >> t ; t -- ; work()) ; return 0 ; }赛后题解
把
a,b 排成一个矩阵(a 为0 行),可以看到在a 里的一行和列的和和操作后的就行一样,b 同理,我们只要求type1,type0 和b 序列里的奇数位置和偶数位置odd=\dfrac{n+1}{2},even=\dfrac{n}{2} ,然后看够不够就好了补题代码
#include <bits/stdc++.h> using namespace std ; long long t , n , cnt0 , cnt1 ; string a , b ; int main() { for(cin >> t ; t -- ;) { cin >> n >> a >> b ; cnt0 = cnt1 = 0 ; for(int i = 0 ; i < n ; i ++) { cnt0 += (a[i] == '1' && i % 2 == 1) ; cnt1 += (a[i] == '1' && i % 2 == 0) ; } for(int i = 0 ; i < n ; i ++) { cnt0 += (b[i] == '1' && i % 2 == 0) ; cnt1 += (b[i] == '1' && i % 2 == 1) ; } long long odd = (n + 1) / 2 , even = n / 2 ; cout << (cnt0 <= odd && cnt1 <= even ? "Yes\n" : "No\n") ; } return 0 ; }复杂度
- 时间复杂度:
O(n) - 空间复杂度:
O(n) 题目总结
D P8197
- 本题得分:
100 初始思路
首先看每个元素
a,b 拥有的个数是否一样,如果是的话直接仿造冒泡排序:枚举b_i ,然后找到元素一样的a_{pos} 然后一个一个交换回去赛场代码
因代码丢失,不予展示(代码类似参考下面这个)
#include <bits/stdc++.h> using namespace std ; long long t , n , a[1005] , b[1005] ; map <long long , long long> mpa , mpb ; int main() { ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ; for(cin >> t ; t -- ;) { cin >> n ; mpa.clear() ; mpb.clear() ; for(int i = 1 ; i <= n ; i ++) { cin >> a[i] ; mpa[a[i]] ++ ; } for(int i = 1 ; i <= n ; i ++) { cin >> b[i] ; mpb[b[i]] ++ ; } int flag = 1 ; for(int i = 1 ; i <= n ; i ++) { if(mpa[a[i]] != mpb[a[i]]) { flag = 0 ; cout << "NO\n" ; break ; } } if(!flag) { continue ; } cout << "YES\n" ; for(int i = 1 ; i <= n ; i ++) { int pos ; for(int j = i ; j <= n ; j ++) { if(b[i] == a[j]) { pos = j ; break ; } } while(pos > i) { cout << pos - 1 << " " << pos << "\n" ; swap(a[pos - 1] , a[pos]) ; pos -- ; } } cout << "0 0\n" ; } return 0 ; }赛后题解
我是对的不用写
补题代码
我是对的不用写复杂度
- 时间复杂度:
O(n^2) - 空间复杂度:
O(n^2) 题目总结
四、赛后反思
做得较好的地方
需要改进的地方
时间安排总结
P7427
#include <bits/stdc++.h> using namespace std ; long long a , b , n , f[100005] ; int main() { cin >> a >> b ; for(; n * (n + 1) / 2 < a + b ; n ++) ; if(n * (n + 1) / 2 != a + b) { cout << "NO" ; return 0 ; } cout << n ; for(int i = n ; i >= 1 ; i --) { if(a >= i) { a -= i ; cout << " " << i ; } } return 0 ; }P13619
#include <bits/stdc++.h> using namespace std ; struct node { int a , b , c ; } ; long long t , n , x[105][105] , h[105][105] , l[105][105] , cnth[105] , cntl[105] , vh[105] , vl[105] ; int main() { for(cin >> t ; t -- ;) { cin >> n ; fill(h[0] , h[n + 1] , 0) ; fill(l[0] , l[n + 1] , 0) ; fill(cnth , cnth + n + 1 , 0) ; fill(cntl , cntl + n + 1 , 0) ; fill(vh , vh + n + 1 , 0) ; fill(vl , vl + n + 1 , 0) ; for(int i = 1 ; i <= n ; i ++) { for(int j = 1 ; j <= n ; j ++) { cin >> x[i][j] ; h[i][x[i][j]] ++ ; l[j][x[i][j]] ++ ; if(h[i][x[i][j]] == 1) { cnth[i] ++ ; } if(l[j][x[i][j]] == 1) { cntl[j] ++ ; } } } vector <int> a , b ; vector <node> ans ; for(int i = 1 ; i <= n ; i ++) { if(cnth[i] == n) { a.push_back(i) ; vh[i] = 1 ; } if(cntl[i] == n) { b.push_back(i) ; vl[i] = 1 ; } } for(int i = 1 ; a.size() < b.size() ; i ++) { if(!vh[i]) { a.push_back(i) ; } } for(int i = 1 ; a.size() > b.size() ; i ++) { if(!vl[i]) { b.push_back(i) ; } } for(int i = 0 ; i < min(a.size() , b.size()) ; i ++) { int xa = a[i] , yb = b[i] , ok = 0 ; for(int k = 1 ; k <= n ; k ++) { ok |= (k != x[xa][yb] && (h[xa][k] > 1 || l[yb][k] > 1)) ; } for(int k = 1 ; k <= n ; k ++) { if(k != x[xa][yb] && (h[xa][x[xa][yb]] > 2 || l[yb][x[xa][yb]] > 2 || h[xa][k] && l[yb][k] || ok)) { ans.push_back({xa , yb , k}) ; break ; } } } cout << ans.size() << "\n" ; for(node x : ans) { cout << x.a << " " << x.b << " " << x.c << "\n" ; } } return 0 ; }