Namomo Namomo Cockfight Round 3
Posted 2aptx4869
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Namomo Namomo Cockfight Round 3相关的知识,希望对你有一定的参考价值。
太难了
A
接着A题漏判好多, 真不如枚举简单
看代码吧, 一般是漏情况wa
#include <bits/stdc++.h>
#define all(n) (n).begin(), (n).end()
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define sqr(n) (n)*(n)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define IO ios::sync_with_stdio(0); cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef double db;
const int N = 1e5 + 5;
int n, m, _, k, t;
int main() {
IO;
cin >> n;
string s; cin >> s;
if (n == 4 || n == 3) {
if (s == "NN") cout << "Impossible";
else if (n == 4) cout << ‘N‘;
else if (n == 3) cout << ‘Y‘;
} else {
if (s == "YY") cout << "Impossible";
else cout << ‘Y‘;
}
return 0;
}
B
先说无限刷命
t == 1, 显然
其他情况, 无非是跳完 k 之后能返回, 低 k - d 个
说白了就是跳个圈
1 9 2 8 3 7 4 6 5
发现没有隔一个跳一个
只要最大的循环圈大于 cd 即可
没有圈按顺序跳一个算一个
#include <bits/stdc++.h>
#define all(n) (n).begin(), (n).end()
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define sqr(n) (n)*(n)
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
#define IO ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef double db;
const int N = 2e5 + 5;
int n, m, _, k;
ll a[N];
int d[N] = {1, 1};
int main() {
ios::sync_with_stdio(0); cin.tie(0);
for (cin >> _; _; --_) {
cin >> n >> m >> k >> a[1];
rep (i, 2, n) {
cin >> a[i];
d[i] = 1 + (a[i] - a[i - 1] <= m);
}
int mx = n - 1 ? d[2] : 1;
rep (i, 3, n) {
if (a[i] - a[i - 2] <= m) d[i] = d[i - 1] + 1;
mx = max(mx, d[i]);
}
if (mx >= k) { cout << "niao!
"; continue; }
mx = 1;
rep (i, 2, n)
if (a[i] - a[i - 1] <= m) d[i] = d[i - 1] + 1;
else mx = max(mx, d[i - 1]), d[i] = 1;
cout << max(mx, d[n]) << ‘
‘;
}
return 0;
}
以上是关于Namomo Namomo Cockfight Round 3的主要内容,如果未能解决你的问题,请参考以下文章
Namomo Spring Camp 2022 Div2 Week1 每日一题
Namomo Spring Camp 2022 Div2 Week1 每日一题
Namomo Spring Camp 2022 Div1 XOR Inverse Codeforces Round #673 (Div. 1) C. XOR Inverse 按位贪心模拟/字典树分治