模拟赛SXJ202511061800比赛记录&题解
题目请看
最近被一些模拟赛蹂躏了,这场是来思路来的最快的一场比赛

T1
So easy,but...
很简单,判差值和数量即可,我却漏了细节,82point,磕细节磕了1h,才想出正解,64行
贴一下代码
/*
User:Kevinrzy103874
Uid:72
Age:12
*/
#include <bits/stdc++.h>
using namespace std;
#define fre(c) freopen(c".in","r",stdin);freopen(c".out","w",stdout);
#define ll long long
#define endl "\n"
#define ios ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define cst const
cst ll N = 1e5 + 5;
bool flag = true;
ll n, a[N], sum;
inline ll read() {
char c;
ll sum = 0, f = 1;
c = getchar();
while (!isdigit(c)) {
if (c == '-')
f *= -1;
c = getchar();
}
while (isdigit(c)) {
sum = sum * 10 + (c - '0');
c = getchar();
}
return sum * f;
}
int main() {
// ios
fre("rose")
n = read();
for (ll i = 1; i <= n; i ++) {
a[i] = read();
if (a[i] < a[i - 1]) {
// cout << 111;
a[i] ++;
sum ++;
if (a[i - 1] - a[i] > 1 && i - 1 != 0) {
cout << "No";
return 0;
}
}
// cout << a[i] << endl;
}
for (ll i = 1; i <= n; i ++) {
if (a[i] < a[i - 1]) {
flag = false;
break ;
}
}
if (flag) {
cout << "Yes";
return 0;
}
if (sum > 1) {
cout << "No";
return 0;
}
cout << "Yes";
return 0;
}
赛时:100point
赛后:-point
T2
贴一下代码
赛时:point
赛后:point
T3
贴一下代码
赛时:point
赛后:point
T4
贴一下代码
赛时:point
赛后:point
T5
贴一下代码
赛时:point
赛后:point
T6
贴一下代码
赛时:point
赛后:point
T7
贴一下代码
赛时:point
赛后:point
T8
贴一下代码
赛时:point
赛后:point

浙公网安备 33010602011771号