Skip to content

Commit 5ce3cd1

Browse files
committed
Codeforces Round 883 (Div. 3) participate YEsterday
1 parent c3c734d commit 5ce3cd1

14 files changed

+498
-80
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"A. Rudolph and Cut the Rope","group":"Codeforces - Codeforces Round 883 (Div. 3)","url":"https://codeforces.com/contest/1846/problem/0","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"id":1688741252444,"input":"4\n3\n4 3\n3 1\n1 2\n4\n9 2\n5 2\n7 7\n3 4\n5\n11 7\n5 10\n12 9\n3 2\n1 5\n3\n5 6\n4 5\n7 7","output":"2\n2\n3\n0"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ARudolphAndCutTheRope"}},"batch":{"id":"c0a4aa3d-6143-4afa-8b6f-8f95c4ae5de2","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\A_Rudolph_and_Cut_the_Rope.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B. Rudolph and Tic-Tac-Toe","group":"Codeforces - Codeforces Round 883 (Div. 3)","url":"https://codeforces.com/contest/1846/problem/B","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"5\n+X+\nOXO\nOX.\nO+.\n+OX\nX+O\n.XO\nOX.\n+++\nO.+\nX.O\n+..\n.++\nX.O\n+..","output":"X\nO\n+\nDRAW\nDRAW","id":1688747916819},{"id":1688748124463,"input":"1\n+++\n...\nXXX","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BRudolphAndTicTacToe"}},"batch":{"id":"5ff73e5d-39ee-4f02-88c8-0816ad2fbad0","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\B_Rudolph_and_Tic_Tac_Toe.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B. Rudolph and Tic-Tac-Toe","group":"Codeforces - Codeforces Round 883 (Div. 3)","url":"https://codeforces.com/contest/1846/problem/B","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1688741806076,"input":"5\n+X+\nOXO\nOX.\n\nO+.\n+OX\nX+O\n\n.XO\nOX.\n+++\nO.+\nX.O\n+..\n.++\nX.O\n+..","output":"X\nO\n+\nDRAW\nDRAW"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BRudolphAndTicTacToe"}},"batch":{"id":"59eec5dc-f9a1-4729-9279-5037c617c51a","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\B_Rudolph_and_Tic_Tac_Toe.java"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B. Who's Opposite?","group":"Codeforces - Codeforces Round 739 (Div. 3)","url":"https://codeforces.com/problemset/problem/1560/B","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1688825730886,"input":"7\n6 2 4\n2 3 1\n2 4 10\n\n5 3 4\n1 3 2\n2 5 4\n4 3 2","output":"8\n-1\n-1\n-1\n4\n1\n-1"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BWhosOpposite"}},"batch":{"id":"705bae45-b83f-4bc3-b224-f8598437df7a","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\B_Who_s_Opposite.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"C. Rudolf and the Another Competition","group":"Codeforces - Codeforces Round 883 (Div. 3)","url":"https://codeforces.com/contest/1846/problem/C","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1688747097141,"input":"5\n\n3 3 120\n20 15 110\n90 90 100\n40 40 40\n\n2 1 120\n30\n30\n\n1 3 120\n10 20 30\n\n3 2 27\n8 9\n10 7\n10 8\n\n3 3 15\n7 2 6\n7 5 4\n1 9 8","output":"2\n1\n1\n2\n1"},{"id":1688747129672,"input":"1\n3 2 27\n\n8 9\n10 7\n10 8","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"CRudolfAndTheAnotherCompetition"}},"batch":{"id":"edf5cd60-1393-42a4-8595-55ed06b95c2a","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\C_Rudolf_and_the_Another_Competition.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"C. Rudolf and the Another Competition","group":"Codeforces - Codeforces Round 883 (Div. 3)","url":"https://codeforces.com/contest/1846/problem/C","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"5\n3 3 120\n20 15 110\n90 90 100\n40 40 40\n2 1 120\n30\n30\n1 3 120\n10 20 30\n3 2 27\n8 9\n10 7\n10 8\n3 3 15\n7 2 6\n7 5 4\n1 9 8\n","output":"2\n1\n1\n2\n1\n","id":1688747080817}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"CRudolfAndTheAnotherCompetition"}},"batch":{"id":"abafb447-bc6e-422d-84b3-3b5875037216","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\C_Rudolf_and_the_Another_Competition.java"}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"Replace It","group":"HackerRank - Final Exam | Introduction to C++ For DSA | Batch 03","url":"https://www.hackerrank.com/contests/final-exam-a-introduction-to-c-for-dsa-a-batch-03/challenges/replace-it-1-1","interactive":false,"memoryLimit":512,"timeLimit":4000,"tests":[{"input":"2\nthatsagoodmomentforgoodrelations good\ncanyoutellmewhereicanfindheriwillbegreatefultoyouifyoutellmetheanswer you","output":"thatsa$momentfor$relations\ncan$tellmewhereicanfindheriwillbegreatefulto$if$tellmetheanswer","id":1688660758022}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ReplaceIt"}},"batch":{"id":"5c4fa047-5f0f-492c-95b7-30c84ff2b543","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\Replace_It.cpp"}
1+
{"name":"Replace It","group":"HackerRank - Final Exam | Introduction to C++ For DSA | Batch 03","url":"https://www.hackerrank.com/contests/final-exam-a-introduction-to-c-for-dsa-a-batch-03/challenges/replace-it-1-1","interactive":false,"memoryLimit":512,"timeLimit":4000,"tests":[{"id":1688660758022,"input":"2\nthatsagoodmomentforgoodrelations good\ncanyoutellmewhereicanfindheriwillbegreatefultoyouifyoutellmetheanswer you","output":"thatsa$momentfor$relations\ncan$tellmewhereicanfindheriwillbegreatefulto$if$tellmetheanswer"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ReplaceIt"}},"batch":{"id":"5c4fa047-5f0f-492c-95b7-30c84ff2b543","size":1},"srcPath":"d:\\Competitive_Programming_Journey\\Codeforces_Solutions\\Replace_It.cpp"}

Codeforces_Solutions/.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"iostream": "cpp",
44
"cmath": "cpp",
55
"random": "cpp",
6-
"regex": "cpp"
6+
"regex": "cpp",
7+
"istream": "cpp"
78
}
89
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
// **************** Author : Tashin.Parvez *************************\
3+
// **************** Updated: 21-06-23 *************************\
4+
5+
#include <bits/stdc++.h>
6+
#define faster \
7+
ios_base::sync_with_stdio(false); \
8+
cin.tie(0); \
9+
cout.tie(0);
10+
#define Read(x) freopen(x, "r", stdin)
11+
#define Write(x) freopen(x, "w", stdout)
12+
#define CRACKED return 0;
13+
#define nl "\n"
14+
15+
// data_type_compressions :
16+
#define int long long
17+
#define ull unsigned long long
18+
#define ld long double
19+
20+
#define PI 3.14159265358979323846
21+
22+
// I/O :
23+
#define loop(n) for (int i = 0; i < n; i++) // 0 to n Input or Output
24+
#define output(x) cout << x << nl // out
25+
#define printarray(arr, len) \
26+
for (int i = 0; i < len; i++) \
27+
{ \
28+
cout << arr[i] << " "; \
29+
if (i + 1 == len) \
30+
cout << endl; \
31+
} // array print
32+
33+
#define sq(x) ((x) * (x)) // x^2 square
34+
#define len(s) s.length()
35+
#define setDec(x) fixed << setprecision(x)
36+
37+
#define YES printf("YES\n")
38+
#define Yes printf("Yes\n")
39+
#define NO printf("NO\n")
40+
#define No printf("No\n")
41+
42+
using namespace std;
43+
44+
/*
45+
int n; cin>>n;
46+
int arr[n];
47+
for(auto &v : arr) cin>>v;
48+
49+
50+
if(!(i&1)) //-------------- EVEN (for even --->> i&1 == 0)
51+
cout<<i<<nl;
52+
53+
*/
54+
55+
void solution()
56+
{
57+
int i, j, k, l, m, n, a, b, c, d, w, x, y, z, t, count = 0, index;
58+
string s;
59+
bool flag = false;
60+
61+
cin >> n;
62+
int height[n], length[n];
63+
for (int i = 0; i < n; i++)
64+
{
65+
cin >> height[i] >> length[i];
66+
if (height[i] <= length[i])
67+
{
68+
height[i] = 0;
69+
length[i] = 0;
70+
count++;
71+
}
72+
}
73+
cout << n - count << nl;
74+
}
75+
76+
int32_t main()
77+
{
78+
faster;
79+
80+
// #ifdef TashinParvez
81+
// Read("input.txt");
82+
// // Write("output.txt");
83+
// #endif // TashinParvez
84+
85+
int t = 1;
86+
cin >> t;
87+
int c = 1;
88+
89+
while (t--)
90+
{
91+
// cout << "Case " << c++ << ": ";
92+
solution();
93+
}
94+
95+
CRACKED;
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
int main()
4+
{
5+
int t;
6+
cin >> t;
7+
while (t--)
8+
{
9+
char a[3][3];
10+
for (int i = 0; i < 3; i++)
11+
for (int j = 0; j < 3; j++)
12+
cin >> a[i][j];
13+
14+
int flag = 1;
15+
16+
char c;
17+
c = a[0][0];
18+
if ((c == a[0][1] && c == a[0][2] && c != '.') || (c == a[1][0] && c == a[2][0] && c != '.') ||
19+
(c == a[1][1] && c == a[2][2] && c != '.'))
20+
{
21+
cout << c << endl;
22+
flag = 0;
23+
}
24+
25+
c = a[0][1];
26+
if (c == a[1][1] && c == a[2][1] && c != '.')
27+
{
28+
cout << c << endl;
29+
flag = 0;
30+
}
31+
c = a[1][0];
32+
if (c == a[1][1] && c == a[1][2] && c != '.')
33+
{
34+
cout << c << endl;
35+
flag = 0;
36+
}
37+
c = a[2][0];
38+
if (c == a[2][1] && c == a[2][2] && c != '.')
39+
{
40+
cout << c << endl;
41+
flag = 0;
42+
}
43+
44+
c = a[0][2];
45+
if ((c == a[1][2] && c == a[2][2] && c != '.') || (c == a[1][1] && c == a[2][0] && c != '.'))
46+
{
47+
cout << c << endl;
48+
flag = 0;
49+
}
50+
51+
if (flag == 1)
52+
cout << "DRAW" << endl;
53+
}
54+
return 0;
55+
}
+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
2+
// **************** Author : Tashin.Parvez *************************\
3+
// **************** Updated: 21-06-23 *************************\
4+
5+
#include <bits/stdc++.h>
6+
#define faster \
7+
ios_base::sync_with_stdio(false); \
8+
cin.tie(0); \
9+
cout.tie(0);
10+
#define Read(x) freopen(x, "r", stdin)
11+
#define Write(x) freopen(x, "w", stdout)
12+
#define CRACKED return 0;
13+
#define nl "\n"
14+
15+
// data_type_compressions :
16+
#define int long long
17+
#define ull unsigned long long
18+
#define ld long double
19+
20+
#define PI 3.14159265358979323846
21+
22+
// I/O :
23+
#define loop(n) for (int i = 0; i < n; i++) // 0 to n Input or Output
24+
#define output(x) cout << x << nl // out
25+
#define printarray(arr, len) \
26+
for (int i = 0; i < len; i++) \
27+
{ \
28+
cout << arr[i] << " "; \
29+
if (i + 1 == len) \
30+
cout << endl; \
31+
} // array print
32+
33+
#define sq(x) ((x) * (x)) // x^2 square
34+
#define len(s) s.length()
35+
#define setDec(x) fixed << setprecision(x)
36+
37+
#define YES printf("YES\n")
38+
#define Yes printf("Yes\n")
39+
#define NO printf("NO\n")
40+
#define No printf("No\n")
41+
42+
using namespace std;
43+
44+
/*
45+
int n; cin>>n;
46+
int arr[n];
47+
for(auto &v : arr) cin>>v;
48+
49+
50+
if(!(i&1)) //-------------- EVEN (for even --->> i&1 == 0)
51+
cout<<i<<nl;
52+
53+
*/
54+
55+
void solution()
56+
{
57+
int i, j, k, l, m, n, a, b, c, d, w, x, y, z, t, count = 0, index;
58+
string s;
59+
bool flag = false;
60+
61+
cin >> a >> b >> c;
62+
int temp = a + b;
63+
64+
b = max(a, b);
65+
a = temp - b;
66+
x = b - a;
67+
68+
// cout << "ADD " << x;
69+
int higg = b + x - a;
70+
if ((higg) % 2 != 0 || b > higg || a > higg)
71+
{
72+
cout << -1 << nl;
73+
return;
74+
}
75+
// cout << "HIGGEST " << higg << nl;
76+
if (c > a && c < b)
77+
{
78+
// cout << "TASHIN " << nl;
79+
int ans = c + x;
80+
if (ans > higg)
81+
{
82+
83+
if (ans - higg >= 1 && a > ans - higg)
84+
cout << ans - higg << nl;
85+
else
86+
cout << -1 << nl;
87+
}
88+
else if (b + x >= ans && b < ans)
89+
{
90+
// cout << c << nl;
91+
cout << ans << nl;
92+
}
93+
94+
else
95+
cout << -1 << nl;
96+
}
97+
else
98+
{
99+
// cout << "TASHIN " << nl;
100+
if (c > higg)
101+
{
102+
cout << -1 << nl;
103+
return;
104+
}
105+
else if (c > b)
106+
{
107+
int ans = c - x;
108+
if (ans != b && ans != a)
109+
cout << ans << nl;
110+
else
111+
cout << -1 << nl;
112+
}
113+
else
114+
{
115+
// c < A
116+
int ans = c + x;
117+
if (ans != b && ans != a && ans > a && ans < b)
118+
cout << ans << nl;
119+
else
120+
cout << -1 << nl;
121+
}
122+
}
123+
}
124+
125+
int32_t main()
126+
{
127+
faster;
128+
129+
// #ifdef TashinParvez
130+
// Read("input.txt");
131+
// // Write("output.txt");
132+
// #endif // TashinParvez
133+
134+
int t = 1;
135+
cin >> t;
136+
int c = 1;
137+
138+
while (t--)
139+
{
140+
// cout << "Case " << c++ << ": ";
141+
solution();
142+
}
143+
144+
CRACKED;
145+
}

0 commit comments

Comments
 (0)