The 6th Liaoning Provincial Collegiate Programming Contest-2025-辽宁省赛-赛后 vp 总结 · znzryb
## 基本情况
乱打的,比较狗屎了。

## 心得感悟
感觉还是要做中国的省赛,感觉中国的题目和国外的题目还是风格有所不同吧。
## 题目 [I take from the richer](https://codeforces.com/gym/106380/problem/I)
就是这个排序一遍以后直接模拟。
不难发现,肯定是先选小的数,**因为先选大的数,小的数就没法贡献了**。
这种一定要小心这个加上一个负数,要用这个 max 0ll 去兜底。

[https://codeforces.com/gym/106380/submission/366235168](https://codeforces.com/gym/106380/submission/366235168)
::: 源代码
```cpp
/**
* Problem: I. I take from the richer
* Contest: The 6th Liaoning Provincial Collegiate Programming Contest
* Judge: Codeforces
* URL: https://codeforces.com/gym/106380/problem/I
* Created: 2026-03-11 17:59:15
* Author: Gospel_rock
* My blog: https://znzryb.com/
*
* Powered by AutoCp https://github.com/Pushpavel/AutoCp
*/
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define lson(o) (o<<1)
#define rson(o) (o<<1|1)
#define SZ(a) ((long long) a.size())
#define debug(var) cerr << #var <<" = ["<<var<<"]"<<"\n";
#define debug1d(a) \
cerr << #a << " = ["; \
for (int i = 0; i < (int)(a).size(); i++) \
cerr << (i ? ", " : "") << a[i]; \
cerr << "]\n";
#define debug2d(a) \
cerr << #a << " = [\n"; \
for (int i = 0; i < (int)(a).size(); i++) \
{ \
cerr << " ["; \
for (int j = 0; j < (int)(a[i]).size(); j++) \
cerr << (j ? ", " : "") << a[i][j]; \
cerr << "]\n"; \
} \
cerr << "]\n";
#define cend cerr<<"\n-----------\n"
#define fsp(x) fixed<<setprecision(x)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using DB = double;
using i128 = __int128;
using CD = complex<double>;
static constexpr ll MAXN = (ll)1e6+10, INF = (1ll<<61)-1;
static constexpr ll mod = 998244353; // (ll)1e9+7;
static constexpr double eps = 1e-8;
const double pi = acos(-1.0);
ll lT,testcase;
/*
*
*/
void Solve() {
ll N;
cin >> N;
vector<ll> A(N);
for (int i=0;i<N;++i) {
cin>>A[i];
}
// for (int i=1;i<N;++i) {
// A[i]-=A[0];
// A[i]=max(A[i],0ll);
// }
// ll l=0,r=accumulate(A.begin()+1,A.end(),0ll);
// auto check=[&](ll add) -> bool {
// for (int i=1;i<N;++i) {
//
// }
// };
// while (l<r) {
// ll mid=l+r>>1;
// if (check(mid)) {
//
// }else {
//
// }
// }
// cout<<l+A[0]<<"\n";
sort(A.begin()+1,A.end());
ll ans=A[0];
for (int i=1;i<N;++i) {
ans+=max(0ll,(A[i]+1-ans)/2);
}
cout<<ans<<"\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef LOCAL
cout.setf(ios::unitbuf); // 无缓冲流,方便我们调试
#endif
cin >> lT;
for (testcase=1;testcase<=lT;++testcase)
Solve();
return 0;
}
/*
AC
https://codeforces.com/gym/106380/submission/366235168
*/
```
:::
## 题目 [Just reseat!](https://codeforces.com/gym/106380/problem/J)
模拟题,不多说了。
[https://codeforces.com/gym/106380/submission/366229614](https://codeforces.com/gym/106380/submission/366229614)
::: 源代码
```cpp
/**
* Problem: J. Just reseat!
* Contest: The 6th Liaoning Provincial Collegiate Programming Contest
* Judge: Codeforces
* URL: https://codeforces.com/gym/106380/problem/J
* Created: 2026-03-11 19:12:09
* Author: Gospel_rock
* My blog: https://znzryb.com/
*
* Powered by AutoCp https://github.com/Pushpavel/AutoCp
*/
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define lson(o) (o<<1)
#define rson(o) (o<<1|1)
#define SZ(a) ((long long) a.size())
#define debug(var) cerr << #var <<" = ["<<var<<"]"<<"\n";
#define debug1d(a) \
cerr << #a << " = ["; \
for (int i = 0; i < (int)(a).size(); i++) \
cerr << (i ? ", " : "") << a[i]; \
cerr << "]\n";
#define debug2d(a) \
cerr << #a << " = [\n"; \
for (int i = 0; i < (int)(a).size(); i++) \
{ \
cerr << " ["; \
for (int j = 0; j < (int)(a[i]).size(); j++) \
cerr << (j ? ", " : "") << a[i][j]; \
cerr << "]\n"; \
} \
cerr << "]\n";
#define cend cerr<<"\n-----------\n"
#define fsp(x) fixed<<setprecision(x)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using DB = double;
using i128 = __int128;
using CD = complex<double>;
static constexpr ll MAXN = (ll)1e6+10, INF = (1ll<<61)-1;
static constexpr ll mod = 998244353; // (ll)1e9+7;
static constexpr double eps = 1e-8;
const double pi = acos(-1.0);
ll lT,testcase;
/*
*
*/
// struct J_id {
// ll
// };
void Solve() {
ll N,M;
cin >> N >> M;
vector<vector<ll> > g(N+2);
for (int i=1;i<=M;++i) {
ll op;
cin>>op;
if (op==1) {
ll exp,id;
cin>>exp>>id;
exp--;
g[exp].push_back(id);
}else {
ll exp1,j1,exp2,j2;
cin>>exp1>>j1>>exp2>>j2;
exp1--;
exp2--;
j1--;
j2--;
swap(g[exp1][j1],g[exp2][j2]);
}
}
for (int i=0;i<N;++i) {
cout<<SZ(g[i])<<" ";
for (int j=0;j<SZ(g[i]);++j) {
cout<<g[i][j]<<" ";
}
cout<<"\n";
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef LOCAL
cout.setf(ios::unitbuf); // 无缓冲流,方便我们调试
#endif
// cin >> lT;
// for (testcase=1;testcase<=lT;++testcase)
Solve();
return 0;
}
/*
AC
https://codeforces.com/gym/106380/submission/366229614
*/
```
:::
## 题目 [Do you play Ballance?](https://codeforces.com/gym/106380/problem/D)
直接分类讨论。
```cpp
vector<A_b_c> A(N+2);
vector<ll> cnt(10);
for (int i=1;i<=N;++i) {
ll a,b,c;
cin>>a>>b>>c;
A[i]={a,b,c};
if (A[i]==A_b_c{1,0,0}) {
cnt[1]++;
}else if (A[i]==A_b_c{0,1,0}) {
cnt[2]++;
}else if (A[i]==A_b_c{0,0,1}){
cnt[3]++;
}
}
if (cnt[1] && cnt[2] && cnt[3]) {
cout<<3<<"\n";
return;
}
for (int i=1;i<=N;++i) {
if (A[i]==A_b_c{1,0,0}) {
}else if (A[i]==A_b_c{0,1,0}) {
}else if (A[i]==A_b_c{0,0,1}){
}else {
if (A[i].a && cnt[1]) {
++cnt[1];
}else if (A[i].b && cnt[2]) {
++cnt[2];
}else if (A[i].c && cnt[3]) {
++cnt[3];
}else if (A[i]==A_b_c{1,1,0}) {
++cnt[4];
}else if (A[i]==A_b_c{1,0,1}) {
++cnt[5];
}else if (A[i]==A_b_c{0,1,1}) {
++cnt[6];
}else if (A[i]==A_b_c{1,1,1}) {
++cnt[7];
}
}
}
ll ans1=ll(bool(cnt[1]))+ll(bool(cnt[2]))+ll(bool(cnt[3]));
ll ans2=ll(bool(cnt[4]))+ll(bool(cnt[5]))+ll(bool(cnt[6]));
ll ans=ans1;
if (ans1) {
if (ans2) {
++ans;
}
}else {
if (ans2<=2) {
ans=1;
}else {
ans=2;
}
}
if (ans==0 && cnt[7]) {
++ans;
}
cout<<ans<<"\n";
```
[https://codeforces.com/gym/106380/submission/366228036](https://codeforces.com/gym/106380/submission/366228036)
::: 源代码
```cpp
/**
* Problem: D. Do you play Ballance?
* Contest: The 6th Liaoning Provincial Collegiate Programming Contest
* Judge: Codeforces
* URL: https://codeforces.com/gym/106380/problem/D
* Created: 2026-03-11 18:32:54
* Author: Gospel_rock
* My blog: https://znzryb.com/
*
* Powered by AutoCp https://github.com/Pushpavel/AutoCp
*/
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define lson(o) (o<<1)
#define rson(o) (o<<1|1)
#define SZ(a) ((long long) a.size())
#define debug(var) cerr << #var <<" = ["<<var<<"]"<<"\n";
#define debug1d(a) \
cerr << #a << " = ["; \
for (int i = 0; i < (int)(a).size(); i++) \
cerr << (i ? ", " : "") << a[i]; \
cerr << "]\n";
#define debug2d(a) \
cerr << #a << " = [\n"; \
for (int i = 0; i < (int)(a).size(); i++) \
{ \
cerr << " ["; \
for (int j = 0; j < (int)(a[i]).size(); j++) \
cerr << (j ? ", " : "") << a[i][j]; \
cerr << "]\n"; \
} \
cerr << "]\n";
#define cend cerr<<"\n-----------\n"
#define fsp(x) fixed<<setprecision(x)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using DB = double;
using i128 = __int128;
using CD = complex<double>;
static constexpr ll MAXN = (ll)1e6+10, INF = (1ll<<61)-1;
static constexpr ll mod = 998244353; // (ll)1e9+7;
static constexpr double eps = 1e-8;
const double pi = acos(-1.0);
ll lT,testcase;
/*
*
*/
struct A_b_c {
ll a,b,c;
auto operator<=>(const A_b_c&o) const = default;
};
void Solve() {
ll N;
cin >> N;
vector<A_b_c> A(N+2);
vector<ll> cnt(10);
for (int i=1;i<=N;++i) {
ll a,b,c;
cin>>a>>b>>c;
A[i]={a,b,c};
if (A[i]==A_b_c{1,0,0}) {
cnt[1]++;
}else if (A[i]==A_b_c{0,1,0}) {
cnt[2]++;
}else if (A[i]==A_b_c{0,0,1}){
cnt[3]++;
}
}
if (cnt[1] && cnt[2] && cnt[3]) {
cout<<3<<"\n";
return;
}
for (int i=1;i<=N;++i) {
if (A[i]==A_b_c{1,0,0}) {
}else if (A[i]==A_b_c{0,1,0}) {
}else if (A[i]==A_b_c{0,0,1}){
}else {
if (A[i].a && cnt[1]) {
++cnt[1];
}else if (A[i].b && cnt[2]) {
++cnt[2];
}else if (A[i].c && cnt[3]) {
++cnt[3];
}else if (A[i]==A_b_c{1,1,0}) {
++cnt[4];
}else if (A[i]==A_b_c{1,0,1}) {
++cnt[5];
}else if (A[i]==A_b_c{0,1,1}) {
++cnt[6];
}else if (A[i]==A_b_c{1,1,1}) {
++cnt[7];
}
}
}
ll ans1=ll(bool(cnt[1]))+ll(bool(cnt[2]))+ll(bool(cnt[3]));
ll ans2=ll(bool(cnt[4]))+ll(bool(cnt[5]))+ll(bool(cnt[6]));
ll ans=ans1;
if (ans1) {
if (ans2) {
++ans;
}
}else {
if (ans2<=2) {
ans=1;
}else {
ans=2;
}
}
if (ans==0 && cnt[7]) {
++ans;
}
cout<<ans<<"\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef LOCAL
cout.setf(ios::unitbuf); // 无缓冲流,方便我们调试
#endif
// cin >> lT;
// for (testcase=1;testcase<=lT;++testcase)
Solve();
return 0;
}
/*
AC
https://codeforces.com/gym/106380/submission/366228036
*/
```
:::