Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;

int n, m, k;
int main() {
cin >> n >> m >> k;
k -= 3; m += k;
m %= n;
if (m == 0) {
m = n;
}
if (m < 0) {
m = n + m;
}
cout << m;
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
int res = 1;
int n; cin >> n;
for (int i = 1; i <= n; i++) {
res *= i;
}
cout << res;
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
int n, m; cin >> n >> m;
int a[1001] = {}, b[1001] = {};
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
int mx = -1e9;
for (int i = 0; i < max(n, m); i++) {
mx = max(b[i] - a[i], mx);
}
cout << (mx < 0 ? 0 : mx);
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
int n; cin >> n; string st1; string st2;
cin >> st1;
cin >> st2;
if (st1[0] != st2[0] || st1[n - 1] != st2[n - 1]) {
cout << "NO"; return 0;
}
char arr[5] = { 'a','e','i','o','u' };
vector<char>a; vector<char>b;
for (int i = 1; i < st1.size() - 1; i++) {
for (int k = 0; k < 5; k++) {
if (st1[i] == arr[k]) {
a.push_back(arr[k]);
st1.erase(st1.begin() + i);
i--;
break;
}
}
}
for (int i = 1; i < st2.size() - 1; i++) {
for (int k = 0; k < 5; k++) {
if (st2[i] == arr[k]) {
b.push_back(arr[k]);
st2.erase(st2.begin() + i);
i--;
break;
}
}
}
sort(all(a)); sort(all(b));
if (st1 != st2) {
cout << "NO"; return 0;
}
if (a.size() != b.size()) {
cout << "NO"; return 0;
}
for (int i = 0; i < a.size(); i++) {
if (a[i] != b[i]) {
cout << "NO"; return 0;
}
}
cout << "YES";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
ll n, m; cin >> n >> m;
if ((n - 1) % (m + 1)) {
cout << "Can win"; return 0;
}
cout << "Can't win";
}


48 changes: 48 additions & 0 deletions Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;

int n, m, t;
int k;
int tmp = 0;
int main() {
fastio;
vector<int>a; vector<int>b;
cin >> t;
while (t--) {
a.clear(); b.clear();
cin >> n;
for (int i = 0; i < n; i++) {
cin >> k;
a.push_back(k);
}
cin >> m;
for (int i = 0; i < m; i++) {
cin >> k; b.push_back(k);
}
sort(all(a));
sort(all(b));
if (a[n - 1] >= b[m - 1]) {
cout << "Alice" << endl;
}
else if (a[n - 1] <= b[m - 1]) {
cout << "Bob" << endl;
}
if (a[n - 1] <= b[m - 1]) {
cout << "Bob" << endl;
}
else if (a[n - 1] >= b[m - 1]) {
cout << "Alice" << endl;
}



}
}