Educational Codeforces Round 123 发表于 2022-03-10 | 分类于 codeforce | 阅读次数: | A:Doors and Keys1234567891011121314151617181920212223242526272829303132#include <iostream>#include <bits/stdc++.h>#include <map>#include <algorithm>using namespace std;int main(){ int t; cin >> t; while(t--) { string s; map<char, bool> vis; cin >> s; int flag = 0; for (int i = 0; i < s.size(); i++) { if(s[i] <= 'Z' && s[i] >= 'A') { if(!vis[s[i] + 32]) { flag = 1; break; } } vis[s[i]] = true; } if(flag || vis.size() != 6) { cout << "NO" << endl; } else { cout << "YES" << endl; } } return 0;} B:Anti-Fibonacci Permutation12345678910111213141516171819202122232425262728293031323334#include <bits/stdc++.h>using namespace std;//如果是1在的位置,后面两者需要调换void print(int x, int n) { vector<int>vec; int t = n; while(t--) { vec.push_back(x%n); x++; } for(int i = 0; i < vec.size(); i++) { if(vec[i] == 0 && i < vec.size() - 2) { swap(vec[i + 1], vec[i + 2]); } cout << vec[i] + 1 << " "; } cout << endl;}int main(){ int t; cin >> t; while(t--) { int n; cin >> n; for(int i = 1; i <= n; i++) { print(i, n); } } return 0;} C:Increase Subarray Sums123456789101112131415161718192021222324252627282930313233#include <bits/stdc++.h>using namespace std;#define ll long long const int maxn = 5100;const int mod = 1000000007;ll a[maxn];ll sum[maxn];int main(){ int t; cin >> t; while(t--) { int n, x; cin >> n >> x; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i-1]; sum[i] = min(sum[i-1], a[i]); } long long ans = 0; for (int i=0; i<=n; i++) { for (int j=i; j<=n; j++) { ans = max(ans, a[j] - sum[j-i] + i*x); } cout << ans << " "; } cout << endl; } return 0;}