initial commit

This commit is contained in:
ShazidMahsrafi 2023-08-03 02:43:03 +06:00
parent 181721e495
commit 0e75028455
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int a,b,c;
cin>>a>>b>>c;
if(a+b>=10)
cout<<"YES"<<endl;
else if(b+c>=10)
cout<<"YES"<<endl;
else if(a+c>=10)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}

View File

@ -0,0 +1,44 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
vector<int>v(n);
for(int i=0; i<n; ++i) cin>>v[i];
vector<int>v2;
v2=v;
sort(v2.begin(),v2.end());
bool possible=1;
for(int i=0; i<n; ++i)
{
if(v[i]%2==0 && v2[i]%2!=0)
{
possible=0;
break;
}
else if (v[i]%2!=0 && v2[i]%2==0)
{
possible=0;
break;
}
}
if(possible)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}