20260917
一、比赛基本情况
- 比赛日期:
- 比赛时长:至,个小时
- 比赛得分:
- 比赛排名:
二、比赛整体回顾
A
思维题,想完发现代码只有十几行
B
模拟题
C
不会写了个错解
D
困难题,无人做出
三、题目复盘
A CF2211A
- 本题得分:
初始思路
对于每个要保留的数我们都可以永远不删除,因为他不可能既是最大值也是最小值,所以每个数的答案都是
考场解题过程
光速写完
考场代码
#include <bits/stdc++.h>
using namespace std ;
long long t , n , a[105] ;
int main() {
freopen("delete.in" , "r" , stdin) ;
freopen("delete.out" , "w" , stdout) ;
ios::sync_with_stdio(0) ;
cin.tie(0) ;
cout.tie(0) ;
for(cin >> t ; t -- ;) {
cin >> n ;
for(int i = 1 ; i <= n ; i ++) {
cin >> a[i] ;
cout << min(2ll , n) << " " ;
}
cout << "\n" ;
}
return 0 ;
} 赛后题解
我是对的
补题代码
我是对的
复杂度
- 时间复杂度:
- 空间复杂度:
题目总结
B D1603
- 本题得分:
初始思路
直接模拟即可
考场解题过程
非常顺利
考场代码
#include <bits/stdc++.h>
using namespace std ;
int t , n , a[1005] ;
int main() {
freopen("wave.in" , "r" , stdin) ;
freopen("wave.out" , "w" , stdout) ;
ios::sync_with_stdio(0) ;
cin.tie(0) ;
cout.tie(0) ;
for(cin >> t ; t -- ;) {
cin >> n ;
for(int i = 1 ; i <= n ; i ++) {
cin >> a[i] ;
}
if(a[2] == a[1]) {
cout << "NO\n" ;
continue ;
}
int op = (a[2] > a[1]) , flag = 1 ;
for(int i = 3 ; i <= n ; i ++) {
if(i % 2) {
flag &= (op != (a[i] > a[i - 1])) ;
} else {
flag &= (op == (a[i] > a[i - 1])) ;
}
}
cout << (flag ? "YES\n" : "NO\n") ;
}
return 0 ;
}赛后题解
我是对的
赛后代码
我是对的
复杂度
- 时间复杂度:
- 空间复杂度:
题目总结
C CF2152B
- 本题得分:
初始思路
我不想说
复杂度
- 时间复杂度:
- 空间复杂度:
赛场做题过程
自我感觉良好
赛场代码
#include <bits/stdc++.h>
using namespace std ;
long long t , n , rk , ck , rd , cd ;
int main() {
freopen("catch.in" , "r" , stdin) ;
freopen("catch.out" , "w" , stdout) ;
ios::sync_with_stdio(0) ;
cin.tie(0) ;
cout.tie(0) ;
for(cin >> t ; t -- ;) {
cin >> n >> rk >> ck >> rd >> cd ;
if(rk == rd && ck < cd) {
cout << cd ;
} else if(rk == rd && ck > cd) {
cout << n - cd ;
} else if(ck == cd && rk < rd) {
cout << rd ;
} else if(ck == cd && rk > rd) {
cout << n - rd ;
} else {
cout << max({cd , rd , n - cd , n - rd}) ;
}
cout << "\n" ;
}
return 0 ;
}
赛后题解
首先D的移动范围比K广,棋盘有限,所以肯定可以抓上K,然后D追上K最好的办法是:先沿着对角线与K到达同行或同列,然后一步一步紧逼
补题代码
#include <bits/stdc++.h>
using namespace std ;
long long t , n , rk , ck , rd , cd ;
int main() {
ios::sync_with_stdio(0) ;
cin.tie(0) ;
cout.tie(0) ;
for(cin >> t ; t -- ;) {
cin >> n >> rk >> ck >> rd >> cd ;
long long dx = 0 , dy = 0 ;
if(ck < cd) {
dx = cd ;
} else if(ck > cd) {
dx = n - cd ;
}
if(rk < rd) {
dy = rd ;
} else if(rk > rd) {
dy = n - rd ;
}
cout << max(dx , dy) << "\n" ;
}
return 0 ;
}复杂度
- 时间复杂度:
- 空间复杂度:
题目总结
D CF1506G
- 本题得分:
初始思路
赛场代码
赛后题解
- 就是求的一个子序列,每一个字符都唯一,并且字典序要最大
- 利用反悔贪心,枚举的每个字符,设当前字符串为,如果已经在里出现过了就跳过,否则如果还有字符,并且最靠右的字符字典序比小,并且的最右边的字符后边还有,那么就把的最右边删了并取消标记,最后接上并标记
- 可以用栈
补题代码
#include <bits/stdc++.h>
using namespace std ;
long long t , last[30] , n ;
string s ;
bool vis[30] ;
void work() {
string ans = "" ;
stack <char> stk ;
for(int i = 0 ; i < n ; i ++) {
char c = s[i] ;
if(vis[c - 'a' + 1]) {
continue ;
}
while(stk.size() && stk.top() < c && last[stk.top() - 'a' + 1] > i) {
vis[stk.top() - 'a' + 1] = 0 ;
stk.pop() ;
}
vis[c - 'a' + 1] = 1 ;
stk.push(c) ;
}
while(stk.size()) {
ans = stk.top() + ans ;
stk.pop() ;
}
cout << ans << "\n" ;
}
int main() {
for(cin >> t ; t -- ; ) {
cin >> s ;
n = s.size() ;
fill(last + 1 , last + 30 , 0) ;
for(int i = 0 ; i < n ; i ++) {
last[s[i] - 'a' + 1] = i ;
}
fill(vis + 1 , vis + 30 , 0) ;
work() ;
}
return 0 ;
}复杂度
- 时间复杂度:
- 空间复杂度:
题目总结
四、赛后反思
做得较好的地方
需要改进的地方
时间安排总结
P1112
#include <bits/stdc++.h>
using namespace std ;
long long l , r , L , R , k , cnt[10000005] ;
set <long long> res ;
int main() {
cin >> l >> r >> L >> R >> k ;
for(int xx = l ; xx <= r ; xx ++) {
for(int a = 1 ; a < xx ; a ++) {
for(int b = 0 ; b < xx ; b ++) {
if(a == b) {
continue ;
}
long long now = 0 , pos = a ;
for(int i = 1 ; i <= 15 ; i ++) {
now = now * xx + pos ;
if(L <= now && now <= R) {
cnt[now] ++ ;
}
if(pos == a) {
pos = b ;
} else {
pos = a ;
}
}
}
}
}
for(int i = L ; i <= R ; i ++) {
if(cnt[i] == k) {
cout << i << "\n" ;
}
}
return 0 ;
}P12834
#include <bits/stdc++.h>
using namespace std ;
int a , b , c , ln , qn ;
string s ;
int main() {
cin >> a >> b >> c ;
if(!c) {
if(a > 0 && b > 0) {
cout << -1 ;
} else {
for(int i = 1 ; i <= a ; i ++) {
cout << 'L' ;
}
for(int i = 1 ; i <= b ; i ++) {
cout << 'Q' ;
}
}
return 0 ;
}
ln = c / 2 + 1 ;
qn = (c + 1) / 2 ;
if(a >= ln && b >= qn) {
for(int i = 1 ; i <= a - ln ; i ++) {
cout << "L" ;
}
for(int i = 1 ; i < ln + qn ; i ++) {
cout << (i % 2 == 0 ? "Q" : "L") ;
}
if((ln + qn) % 2) {
for(int i = 1 ; i <= b - qn ; i ++) {
cout << "Q" ;
}
cout << "L" ;
} else {
for(int i = 1 ; i <= b - qn + 1 ; i ++) {
cout << "Q" ;
}
}
return 0 ;
}
swap(ln , qn) ;
if(a >= ln && b >= qn) {
for(int i = 1 ; i < ln + qn ; i ++) {
cout << (i % 2 ? "Q" : "L") ;
}
if((ln + qn) % 2 == 0) {
cout << "L" ;
for(int i = 1 ; i <= b - qn ; i ++) {
cout << "Q" ;
}
} else {
for(int i = 1 ; i <= b - qn + 1 ; i ++) {
cout << "Q" ;
}
}
return 0 ;
}
cout << -1 ;
return 0 ;
}