当前位置:网站首页>B. Phoenix and Beauty
B. Phoenix and Beauty
2022-06-11 21:43:00 【whitewall_ nine】
// Problem: B. Trouble Sort
// Contest: Codeforces - Codeforces Round #648 (Div. 2)
// URL: https://codeforces.com/problemset/problem/1365/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 2022-03-01 15:43:40
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define mp make_pair
const ll mod = 1e9 + 7;
inline ll qmi (ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1) ans = ans * a%mod;
a = a * a %mod;
b >>= 1;
}
return ans;
}
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
inline ll sub (ll a, ll b) {
return ((a - b ) %mod + mod) %mod;
}
inline ll add (ll a, ll b) {
return (a + b) %mod;
}
inline ll inv (ll a) {
return qmi(a, mod - 2);
}
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n ;i ++) {
cin >> a[i];
}
int ans = 0;
for (int i = 0; i < n; i ++){
int t;
cin >> t;
ans += t;
}
if (ans && ans < n || is_sorted(all(a))) puts("Yes");
else puts("No");
}
int main () {
int t;
t =1;
cin >> t;
while (t --) solve();
return 0;
}
as long as 0 and 1 If the number of is different, we can put them in positive order . Because for every number that is not in position , We can put him in the right place b The opposite number of , Then exchange with the number in the correct position Regardless of the specific number of positions
边栏推荐
- AC自动机
- Flutter implements the JD address selection component
- How to create the simplest SAP kyma function
- LabVIEW controls Arduino to realize ultrasonic ranging (advanced chapter-5)
- JVM|本地方法接口;本地方法栈
- Common file functions
- Website online customer service system Gofly source code development log - 2 Develop command line applications
- 一个Golang的私有库设置问题
- 作为一名 ABAP 资深顾问,下一步可以选择哪一门 SAP 技术作为主攻方向?
- Carry and walk with you. Have you ever seen a "palm sized" weather station?
猜你喜欢

JVM|虚拟机栈(局部变量表;操作数栈;动态链接;方法的绑定机制;方法的调用;方法返回地址)

LaTex实战笔记 3-宏包与控制命令

RPA丨首席财务官如何找到数字化转型“超级入口”?
![[advanced C language] integer storage in memory](/img/a5/6c7df3b8f427fe724922a6b853516f.png)
[advanced C language] integer storage in memory

LeetCode-155-最小栈

即将首发 | 业界首个零售数字化创新白皮书,解锁全链路数字化致胜秘籍
![Analysis on the development history and market development status of China's system integration industry in 2020 [figure]](/img/3c/b53c2a3f59ff6784f128cb98a5a7a2.jpg)
Analysis on the development history and market development status of China's system integration industry in 2020 [figure]

Carry and walk with you. Have you ever seen a "palm sized" weather station?

如何使用事物码 SAT 查找某个 SAPGUI 屏幕字段对应的后台存储数据库表的名称试读版

JVM|运行时数据区;程序计数器(PC寄存器);
随机推荐
Codeforces Round #744 (Div. 3) 解题报告
如何使用事物码 SAT 查找某个 SAPGUI 屏幕字段对应的后台存储数据库表的名称试读版
Redis data type (string)
BZOJ3189 : [Coci2011] Slika
Using the sap ui5 cli command line tool to build and run SAP ui5 applications
LeetCode-104-二叉树的最大深度
LabVIEW Arduino electronic weighing system (project Part-1)
线性表的链式存储结构
继承的所有特征
【历史上的今天】6 月 11 日:蒙特卡罗方法的共同发明者出生;谷歌推出 Google 地球;谷歌收购 Waze
[Part 16] copyonwritearraylist source code analysis and application details [key]
RPA+低代码助推品牌电商启新创变、重启增长
Educational Codeforces Round 114 (Rated for Div. 2) D
LeetCode-322-零钱兑换
JVM|虚拟机栈(局部变量表;操作数栈;动态链接;方法的绑定机制;方法的调用;方法返回地址)
JVM|运行时数据区;程序计数器(PC寄存器);
Why is rpa+ low code a powerful tool to accelerate the digital transformation of finance?
即将首发 | 业界首个零售数字化创新白皮书,解锁全链路数字化致胜秘籍
Experiment 10 Bezier curve generation - experiment improvement - control point generation of B-spline curve
JVM | introduction