Skip to content

Commit 5fc7b10

Browse files
author
remonhasanapu
committed
Updated
1 parent 21fb0d2 commit 5fc7b10

File tree

457 files changed

+6334
-4097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+6334
-4097
lines changed

A.cpp

-30
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// author: remonHasan
2+
#include<bits/stdc++.h>
3+
#include <vector>
4+
#include <algorithm>
5+
using namespace std;
6+
7+
#define ll long long
8+
#define VI vector < int > v;
9+
#define PR pair < int, int >
10+
#define RAB(i, a, b) for (int i = a; i < b; i++)
11+
#define Brain for(auto &it:v)
12+
#define PB push_back
13+
#define IS getline(cin, s);
14+
#define nl cout << "\n";
15+
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
16+
17+
const int MAXN=4e5+5;
18+
int cnt[MAXN];
19+
20+
21+
void solve()
22+
{
23+
int n,m,k; cin>>n>>m>>k;
24+
vector<int> a(n), b(m);
25+
for(int i=0;i<n;i++) cin>>a[i];
26+
for(int i=0;i<m;i++) cin>>b[i];
27+
28+
29+
vector<int> cnt(k + 1, 0);
30+
for (int e : a) {
31+
if (e <= k) {
32+
cnt[e] |= 1;
33+
}
34+
}
35+
36+
for (int e : b) {
37+
if (e <= k) {
38+
cnt[e] |= 2;
39+
}
40+
}
41+
42+
vector<int> c(4, 0);
43+
for (int e : cnt) {
44+
c[e]++;
45+
}
46+
47+
cout << ((c[1] > k / 2) || (c[2] > k / 2) || (c[1] + c[2] + c[3] != k) ? "NO" : "YES") << endl;
48+
}
49+
50+
int main() {
51+
ios;
52+
int t;
53+
cin >> t;
54+
55+
while (t--) {
56+
solve();
57+
}
58+
59+
return 0;
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// author: remonHasan
2+
#include<bits/stdc++.h>
3+
#include <vector>
4+
#include <algorithm>
5+
using namespace std;
6+
7+
#define ll long long
8+
#define VI vector < int > v;
9+
#define PR pair < int, int >
10+
#define RAB(i, a, b) for (int i = a; i < b; i++)
11+
#define Brain for(auto &it:v)
12+
#define PB push_back
13+
#define IS getline(cin, s);
14+
#define nl cout << "\n";
15+
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
16+
17+
const int MAXN=4e5+5;
18+
int cnt[MAXN];
19+
20+
ll findGCD(ll a, ll b){
21+
while(b != 0){
22+
ll tmp = a % b;
23+
a = b;
24+
b = tmp;
25+
}
26+
27+
return a;
28+
}
29+
30+
ll findLCM (ll a, ll b){
31+
return (a * b)/findGCD(a,b);
32+
}
33+
34+
void solve()
35+
{
36+
int n; cin >> n;
37+
vector<ll> k(n);
38+
for(ll i=0;i<n;i++) cin >> k[i];
39+
40+
ll lcm_result = 1;
41+
for(ll i=0;i<n;i++) lcm_result = findLCM(lcm_result,k[i]);
42+
43+
ll sum = 0;
44+
for(ll i=0;i<n;i++) sum += lcm_result / k[i];
45+
46+
if( sum < lcm_result){
47+
for(ll i=0;i<n;i++) cout << lcm_result / k[i] << " ";
48+
cout << endl;
49+
}else{
50+
cout << -1 << endl;
51+
}
52+
}
53+
54+
int main() {
55+
ios;
56+
int t;
57+
cin >> t;
58+
while (t--) {
59+
solve();
60+
}
61+
62+
return 0;
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// author: remonHasan
2+
#include<bits/stdc++.h>
3+
#include <vector>
4+
#include <algorithm>
5+
using namespace std;
6+
7+
#define ll long long
8+
#define VI vector < int > v;
9+
#define PR pair < int, int >
10+
#define RAB(i, a, b) for (int i = a; i < b; i++)
11+
#define Brain for(auto &it:v)
12+
#define PB push_back
13+
#define IS getline(cin, s);
14+
#define nl cout << "\n";
15+
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
16+
17+
const int MAXN=4e5+5;
18+
int cnt[MAXN];
19+
20+
21+
void solve()
22+
{
23+
string input;
24+
getline(cin, input);
25+
26+
vector<int> s;
27+
for (char c : input) {
28+
s.push_back(c - '0');
29+
}
30+
31+
for (int num : s) {
32+
cout << num << " ";
33+
}
34+
cout << endl;
35+
36+
int zeroes = 0;
37+
for (int num : s) {
38+
if (num == 0) {
39+
zeroes++;
40+
}
41+
}
42+
43+
cout << zeroes << endl;
44+
45+
vector<int> cnt(2, 0);
46+
ll ans = 0;
47+
48+
for (int c : s) {
49+
cnt[c]++;
50+
if (c == 0) {
51+
ans += (cnt[1] > 0) ? 1 : 0;
52+
} else {
53+
ans += (zeroes - cnt[0]);
54+
}
55+
}
56+
57+
cout << ans << endl;
58+
}
59+
60+
int main() {
61+
ios;
62+
int t;
63+
cin >> t;
64+
cin.ignore();
65+
66+
while (t--) {
67+
solve();
68+
}
69+
70+
return 0;
71+
}

Codeforces (Rating Wise)/1100/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1200/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1300/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1400/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1500/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1600/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1700/A.cpp

Whitespace-only changes.

Codeforces (Rating Wise)/1800/A.cpp

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include<bits/stdc++.h>
2+
#include <vector>
3+
#include <algorithm>
4+
using namespace std;
5+
6+
#define ll long long
7+
#define VI vector < int > v;
8+
#define PR pair < int, int >
9+
#define RAB(i, a, b) for (int i = a; i < b; i++)
10+
#define Brain for(auto &it:v)
11+
#define PB push_back
12+
#define IS getline(cin, s);
13+
#define nl "\n";
14+
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
15+
16+
const int MAXN=4e5+5;
17+
int cnt[MAXN];
18+
19+
20+
void solve()
21+
{
22+
int n; cin >> n;
23+
string s; cin >> s;
24+
string prevString = s;
25+
sort(s.begin(),s.end());
26+
cout << (prevString == s ? "YES" : "NO") << nl;
27+
}
28+
29+
signed main() {
30+
ios;
31+
int t;
32+
cin >> t;
33+
34+
while (t--) {
35+
solve();
36+
}
37+
38+
return 0;
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include<bits/stdc++.h>
2+
#include <vector>
3+
#include <algorithm>
4+
using namespace std;
5+
6+
#define ll long long
7+
#define VI vector < int > v;
8+
#define PR pair < int, int >
9+
#define RAB(i, a, b) for (int i = a; i < b; i++)
10+
#define Brain for(auto &it:v)
11+
#define PB push_back
12+
#define IS getline(cin, s);
13+
#define nl "\n";
14+
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
15+
16+
void solve()
17+
{
18+
int n,m; cin >> n >> m;
19+
if(m % 2 == 0 && n%2 == 0 && n >= m){
20+
cout << "Yes" << nl;
21+
}else if(m % 2 != 0 && n%2 != 0 && n >= m){
22+
cout << "Yes" << nl;
23+
}else{
24+
cout << "No" << nl;
25+
}
26+
}
27+
28+
signed main() {
29+
ios;
30+
int t;
31+
cin >> t;
32+
33+
while (t--) {
34+
solve();
35+
}
36+
37+
return 0;
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
author: remonhasan
3+
*/
4+
5+
#include<bits/stdc++.h>
6+
using namespace std;
7+
8+
#define fl for(int i=0;i<n;i++)
9+
10+
void solve(int n, int x){
11+
int arr[n];
12+
13+
fl cin >> arr[i];
14+
15+
int maxi = 0 , j = 0;
16+
17+
fl {
18+
int A = arr[i] - j;
19+
maxi = max(maxi, A);
20+
j = arr[i];
21+
}
22+
23+
int B = 2 * (x - arr[n-1]);
24+
maxi = max(B, maxi);
25+
cout<< maxi << endl;
26+
27+
}
28+
29+
int main()
30+
{
31+
ios::sync_with_stdio(0);
32+
cin.tie(0);
33+
int t;
34+
cin >> t;
35+
while(t--){
36+
int n,x;
37+
cin >> n >> x;
38+
solve(n,x);
39+
}
40+
}

0 commit comments

Comments
 (0)