Precreation contest files
This commit is contained in:
18
Codeforces/CodeforcesRound1016(Div3)/DSkibidiTable/input1
Normal file
18
Codeforces/CodeforcesRound1016(Div3)/DSkibidiTable/input1
Normal file
@@ -0,0 +1,18 @@
|
||||
2
|
||||
2
|
||||
5
|
||||
-> 4 3
|
||||
<- 15
|
||||
<- 4
|
||||
-> 3 1
|
||||
-> 1 3
|
||||
1
|
||||
8
|
||||
-> 1 1
|
||||
-> 1 2
|
||||
-> 2 1
|
||||
-> 2 2
|
||||
<- 1
|
||||
<- 2
|
||||
<- 3
|
||||
<- 4
|
||||
13
Codeforces/CodeforcesRound1016(Div3)/DSkibidiTable/output1
Normal file
13
Codeforces/CodeforcesRound1016(Div3)/DSkibidiTable/output1
Normal file
@@ -0,0 +1,13 @@
|
||||
7
|
||||
2 3
|
||||
1 2
|
||||
9
|
||||
13
|
||||
1
|
||||
4
|
||||
3
|
||||
2
|
||||
1 1
|
||||
2 2
|
||||
2 1
|
||||
1 2
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void solve() {
|
||||
int q;
|
||||
cin >> q;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1034(Div3)/ABlackboardGame/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1034(Div3)/ABlackboardGame/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
5
|
||||
2
|
||||
4
|
||||
5
|
||||
7
|
||||
100
|
||||
@@ -0,0 +1,5 @@
|
||||
Alice
|
||||
Bob
|
||||
Alice
|
||||
Alice
|
||||
Bob
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
int n;
|
||||
cin >> n;
|
||||
if (!(n & ((1 << 2) - 1)))
|
||||
cout << "Bob\n";
|
||||
else
|
||||
cout << "Alice\n";
|
||||
}
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1034(Div3)/BTournament/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1034(Div3)/BTournament/cpp.out
Executable file
Binary file not shown.
7
Codeforces/CodeforcesRound1034(Div3)/BTournament/input1
Normal file
7
Codeforces/CodeforcesRound1034(Div3)/BTournament/input1
Normal file
@@ -0,0 +1,7 @@
|
||||
3
|
||||
5 2 3
|
||||
3 2 4 4 1
|
||||
5 4 1
|
||||
5 3 4 5 2
|
||||
6 1 1
|
||||
1 2 3 4 5 6
|
||||
3
Codeforces/CodeforcesRound1034(Div3)/BTournament/output1
Normal file
3
Codeforces/CodeforcesRound1034(Div3)/BTournament/output1
Normal file
@@ -0,0 +1,3 @@
|
||||
YES
|
||||
YES
|
||||
NO
|
||||
@@ -0,0 +1,30 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n, j, k;
|
||||
cin >> n >> j >> k;
|
||||
vector<int> a(n);
|
||||
for (auto &i : a)
|
||||
cin >> i;
|
||||
|
||||
if (a[j - 1] == *max_element(a.begin(), a.end())) {
|
||||
cout << "YES\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (k >= 2)
|
||||
cout << "YES\n";
|
||||
else
|
||||
cout << "NO\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1034(Div3)/CPrefixMinandSuffixMax/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1034(Div3)/CPrefixMinandSuffixMax/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
3
|
||||
6
|
||||
1 3 5 4 7 2
|
||||
4
|
||||
13 10 12 20
|
||||
7
|
||||
1 2 3 4 5 6 7
|
||||
@@ -0,0 +1,3 @@
|
||||
100011
|
||||
1101
|
||||
1000001
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void min_maxer(vector<int> &_a, vector<int> &pre, vector<int> &stu,
|
||||
vector<bool> &map) {
|
||||
int n = _a.size();
|
||||
map[0] = true;
|
||||
map[n - 1] = true;
|
||||
|
||||
for (int i = 1; i < n; i++) {
|
||||
if (_a[i] < _a[i - 1])
|
||||
map[i] = true;
|
||||
if (_a[n - i - 1] < _a[n - i - 2])
|
||||
map[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> a(n);
|
||||
for (auto &i : a)
|
||||
cin >> i;
|
||||
|
||||
vector<int> min_prefix(n), max_stufix(n);
|
||||
vector<bool> map(n);
|
||||
min_maxer(a, min_prefix, max_stufix, map);
|
||||
for (auto i : map)
|
||||
cout << i;
|
||||
cout << "\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
11
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/input1
Normal file
11
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/input1
Normal file
@@ -0,0 +1,11 @@
|
||||
5
|
||||
5
|
||||
1 0 0 1 2
|
||||
6
|
||||
3 2 0 4 5 1
|
||||
6
|
||||
1 2 0 1 3 2
|
||||
4
|
||||
0 3 4 1
|
||||
5
|
||||
0 0 0 0 0
|
||||
5
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/output1
Normal file
5
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/output1
Normal file
@@ -0,0 +1,5 @@
|
||||
1 2 4 3 2 1
|
||||
1 6 5 4 3 2 1
|
||||
1 3 5 4 3 2 1
|
||||
1 3 3 2 1
|
||||
1 1 1 1 1 1
|
||||
31
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/solution.cpp
Normal file
31
Codeforces/CodeforcesRound1034(Div3)/EMEXCount/solution.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "iostream"
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n, x;
|
||||
cin >> n;
|
||||
map<int, int> hash_map;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> x;
|
||||
if (hash_map.count(x) == 0)
|
||||
hash_map[x] = 1;
|
||||
else
|
||||
hash_map[x]++;
|
||||
}
|
||||
|
||||
for (int k = 0; k <= n; k++) {
|
||||
int cur_mex = 0;
|
||||
for (auto &i : hash_map) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/cpp.out
Executable file
Binary file not shown.
8
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/input1
Normal file
8
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/input1
Normal file
@@ -0,0 +1,8 @@
|
||||
7
|
||||
1 4 1 2
|
||||
1 5 2 1
|
||||
3 2 2 1
|
||||
1 3 2 1
|
||||
2 1 1 2
|
||||
3 1 1 2
|
||||
1 100 10000000 10000000
|
||||
7
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/output1
Normal file
7
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/output1
Normal file
@@ -0,0 +1,7 @@
|
||||
3
|
||||
6
|
||||
1
|
||||
3
|
||||
-1
|
||||
-1
|
||||
990000000
|
||||
43
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/solution.cpp
Normal file
43
Codeforces/CodeforcesRound1035(Div2)/AAddorXOR/solution.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int a, b, x, y;
|
||||
cin >> a >> b >> x >> y;
|
||||
|
||||
if (a > b) {
|
||||
if (a - b == 1) {
|
||||
if (a % 2 != 0) {
|
||||
cout << y << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cout << "-1\n";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int diff = b - a;
|
||||
int xdiff = diff * x;
|
||||
if (diff % 2 == 0) {
|
||||
cout << min(xdiff, ((diff * x) / 2) + ((diff * y) / 2)) << endl;
|
||||
return;
|
||||
} else {
|
||||
if (a % 2 != 0) {
|
||||
|
||||
cout << min(xdiff, (diff / 2 + 1) * x + (diff / 2) * y) << endl;
|
||||
return;
|
||||
} else {
|
||||
cout << min(xdiff, (diff / 2) * x + (diff / 2 + 1) * y) << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1037(Div3)/AOnlyOneDigit/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1037(Div3)/AOnlyOneDigit/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
5
|
||||
6
|
||||
96
|
||||
78
|
||||
122
|
||||
696
|
||||
@@ -0,0 +1,5 @@
|
||||
6
|
||||
6
|
||||
7
|
||||
1
|
||||
6
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
int x;
|
||||
cin >> x;
|
||||
string xstr = to_string(x);
|
||||
|
||||
int res = 10;
|
||||
for (const char &i : xstr) {
|
||||
res = min(res, (int)(i - '0'));
|
||||
}
|
||||
cout << res << endl;
|
||||
}
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1037(Div3)/BNoCasinointheMountains/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1037(Div3)/BNoCasinointheMountains/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
5
|
||||
5 1
|
||||
0 1 0 0 0
|
||||
7 3
|
||||
0 0 0 0 0 0 0
|
||||
3 1
|
||||
1 1 1
|
||||
4 2
|
||||
0 1 0 1
|
||||
6 2
|
||||
0 0 1 0 0 0
|
||||
@@ -0,0 +1,5 @@
|
||||
3
|
||||
2
|
||||
0
|
||||
0
|
||||
2
|
||||
@@ -0,0 +1,38 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n, k;
|
||||
cin >> n >> k;
|
||||
vector<int> a(n);
|
||||
for (int &i : a)
|
||||
cin >> i;
|
||||
|
||||
int res = 0;
|
||||
int len = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (len == k) {
|
||||
len = 0;
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
if (a[i] == 0) {
|
||||
len++;
|
||||
}
|
||||
if (a[i] == 1) {
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
if (len == k)
|
||||
res++;
|
||||
cout << res << endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1037(Div3)/CIWillDefinitelyMakeIt/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1037(Div3)/CIWillDefinitelyMakeIt/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
5
|
||||
5 3
|
||||
3 2 1 4 5
|
||||
3 1
|
||||
1 3 4
|
||||
4 4
|
||||
4 4 4 2
|
||||
6 2
|
||||
2 3 6 9 1 2
|
||||
4 2
|
||||
1 2 5 6
|
||||
@@ -0,0 +1,5 @@
|
||||
YES
|
||||
NO
|
||||
YES
|
||||
YES
|
||||
NO
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n, k;
|
||||
cin >> n >> k;
|
||||
vector<int> a(n);
|
||||
for (auto &i : a)
|
||||
cin >> i;
|
||||
int h = a[k - 1];
|
||||
sort(a.begin(), a.end());
|
||||
|
||||
int time = 0;
|
||||
for (auto H : a) {
|
||||
if (H <= h)
|
||||
continue;
|
||||
time += H - h;
|
||||
if (time > h) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
h = H;
|
||||
}
|
||||
|
||||
cout << "YES\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
}
|
||||
BIN
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/cpp.out
Executable file
Binary file not shown.
16
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/input1
Normal file
16
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/input1
Normal file
@@ -0,0 +1,16 @@
|
||||
5
|
||||
6
|
||||
72 24 3 3 3 3
|
||||
3 3 3 6 12 144
|
||||
3
|
||||
1 2 3
|
||||
4 5 6
|
||||
5
|
||||
125 125 125 25 25
|
||||
25 25 25 25 75
|
||||
4
|
||||
123 421 282 251
|
||||
125 1981 239 223
|
||||
3
|
||||
124 521 125
|
||||
125 121 121
|
||||
@@ -0,0 +1,5 @@
|
||||
YES
|
||||
NO
|
||||
YES
|
||||
NO
|
||||
NO
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> pre(n), stu(n);
|
||||
for (int &i : pre)
|
||||
cin >> i;
|
||||
for (int &i : stu)
|
||||
cin >> i;
|
||||
|
||||
if (pre[n - 1] != stu[0]) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
if (pre[i] < pre[i + 1]) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
if (pre[i] % pre[i + 1] != 0) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i = n - 1; i > 0; i--) {
|
||||
if (stu[i] < stu[i - 1]) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
if (stu[i] % stu[i - 1] != 0) {
|
||||
cout << "NO\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
cout << "YES\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
3
|
||||
3
|
||||
2 2 3
|
||||
5
|
||||
4 5 5 2 4
|
||||
1
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
NO
|
||||
YES
|
||||
4
|
||||
4 5 2 4
|
||||
NO
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> a(n);
|
||||
for (int &i : a)
|
||||
cin >> i;
|
||||
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
if (a[i] > a[i + 1]) {
|
||||
cout << "YES\n2\n";
|
||||
cout << a[i] << " " << a[i + 1] << "\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
cout << "NO\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
3
|
||||
2
|
||||
1 2
|
||||
3
|
||||
1 2 3
|
||||
4
|
||||
3 0 2 3
|
||||
@@ -0,0 +1,3 @@
|
||||
2
|
||||
2
|
||||
3
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> a(n);
|
||||
for (auto &i : a)
|
||||
cin >> i;
|
||||
|
||||
cout << min(a[0] + a[1], 2 * a[0]) << "\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
BIN
Codeforces/EducationalCodeforcesRound177(RatedforDiv2)/ACloudberryJam/cpp.out
Executable file
BIN
Codeforces/EducationalCodeforcesRound177(RatedforDiv2)/ACloudberryJam/cpp.out
Executable file
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
2
|
||||
1
|
||||
3
|
||||
@@ -0,0 +1,2 @@
|
||||
2
|
||||
6
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
int n;
|
||||
cin >> n;
|
||||
cout << 2 * n << '\n';
|
||||
}
|
||||
}
|
||||
BIN
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/cpp.out
Executable file
BIN
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/cpp.out
Executable file
Binary file not shown.
11
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/input1
Normal file
11
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/input1
Normal file
@@ -0,0 +1,11 @@
|
||||
5
|
||||
4
|
||||
2 3 5 7
|
||||
4
|
||||
115 9 2 28
|
||||
5
|
||||
8 4 1 6 2
|
||||
6
|
||||
1 5 4 1 4 7
|
||||
2
|
||||
100000 100000
|
||||
@@ -0,0 +1,5 @@
|
||||
YES
|
||||
NO
|
||||
NO
|
||||
YES
|
||||
YES
|
||||
@@ -0,0 +1,55 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int a[200];
|
||||
|
||||
bool check(int a, int b, int c) {
|
||||
if (a + b <= c)
|
||||
return false;
|
||||
if (a + c <= b)
|
||||
return false;
|
||||
if (b + c <= a)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void run() {
|
||||
int n;
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++)
|
||||
cin >> a[i];
|
||||
|
||||
if (n == 2) {
|
||||
if (check(a[0], a[0], a[1]) || check(a[0], a[1], a[1])) {
|
||||
cout << "YES\n";
|
||||
} else {
|
||||
cout << "NO\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n - 2; i++) {
|
||||
if (check(a[i], a[i + 1], a[i + 2])) {
|
||||
cout << "YES\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
if (check(a[i], a[i], a[i + 1]) || check(a[i], a[i + 1], a[i + 1])) {
|
||||
cout << "YES\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cout << "NO\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
run();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user