- 2022牛客多校(七)
- 一、比赛小结
- 二、题目分析及解法(基础题)
- C、Constructive Problems Never Die
- F、Candies
- G、Regular Expression
- J、Melborp Elcissalc
- K、Great Party
- 三、题目分析及解法(进阶题)
- A、
- B、
- D、
- E、
- H、
- I、
比赛链接:"蔚来杯"2022牛客暑期多校训练营7
这场没有打,去参加 RoboCom 了
二、题目分析及解法(基础题) C、Constructive Problems Never Die题目链接:C-Constructive Problems Never Die
题意:
给出一个序列 A A A ,构造一个排列 P P P ,使得 A i ≠ P i , i = 1 , . . . , n A_i\not=P_i, i=1, ..., n Ai=Pi,i=1,...,n
题解:
方法很多
代码:
#include
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
int ok = 0;
vector a(n + 5);
vector p(n + 5);
for (int i = 1; i > a[i];
if (a[i] != a[1]) ok = 1;
}
if (not ok) {
cout
关注
打赏