aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2022-07-13 23:29:10 +0200
committeromagdy7 <omar.professional8777@gmail.com>2022-07-13 23:29:10 +0200
commit0dff824a69c41aea4d4d54017360a368d0c6602f (patch)
treeb7d3e5371acc7a0b8a095dac4225bccf091937f5
parentdd684349c67c988ef19707cb65e637b6906fac75 (diff)
downloadcompetitive-programming-0dff824a69c41aea4d4d54017360a368d0c6602f.tar.xz
competitive-programming-0dff824a69c41aea4d4d54017360a368d0c6602f.zip
Solved some new problems
-rw-r--r--.gitignore2
-rwxr-xr-xMirrorGrid/mainbin0 -> 30448 bytes
-rw-r--r--MirrorGrid/main.cpp30
-rw-r--r--MirrorGrid/main_input0.txt25
-rw-r--r--MirrorGrid/main_output0.txt5
-rwxr-xr-xdoubleStrings/mainbin0 -> 64192 bytes
-rw-r--r--doubleStrings/main.cpp32
-rw-r--r--doubleStrings/main_input0.txt20
-rw-r--r--doubleStrings/main_output0.txt3
-rwxr-xr-xicpcBallons/mainbin0 -> 48656 bytes
-rw-r--r--icpcBallons/main.cpp28
-rw-r--r--icpcBallons/main_input0.txt13
-rw-r--r--icpcBallons/main_output0.txt6
-rwxr-xr-xyesOrYes/mainbin0 -> 24208 bytes
-rw-r--r--yesOrYes/main.cpp22
-rw-r--r--yesOrYes/main_input0.txt11
-rw-r--r--yesOrYes/main_output0.txt10
17 files changed, 207 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 67d9de7..bbd2940 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
binaries
.ccls-cache
*.o
+
+Cypher \ No newline at end of file
diff --git a/MirrorGrid/main b/MirrorGrid/main
new file mode 100755
index 0000000..e41e986
--- /dev/null
+++ b/MirrorGrid/main
Binary files differ
diff --git a/MirrorGrid/main.cpp b/MirrorGrid/main.cpp
new file mode 100644
index 0000000..e72b5a4
--- /dev/null
+++ b/MirrorGrid/main.cpp
@@ -0,0 +1,30 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n;
+ cin >> n;
+ vector<string> arr(n);
+ for (auto &x : arr) {
+ cin >> x;
+ }
+ int count = 0;
+ for (int i = 0; i < n / 2; i++) {
+ for (int j = 0; j < (n + 1) / 2; j++) {
+ int ch1 = arr[i][j] - '0';
+ int ch2 = arr[n - 1 - j][i] - '0';
+ int ch3 = arr[n - i - 1][n - 1 - j] - '0';
+ int ch4 = arr[j][n - 1 -i] - '0';
+ int sum = ch1 + ch2 + ch3 + ch4;
+ count += min(4 - sum, sum);
+ }
+ }
+ cout << count << endl;
+ }
+}
diff --git a/MirrorGrid/main_input0.txt b/MirrorGrid/main_input0.txt
new file mode 100644
index 0000000..019af89
--- /dev/null
+++ b/MirrorGrid/main_input0.txt
@@ -0,0 +1,25 @@
+5
+3
+010
+110
+010
+1
+0
+5
+11100
+11011
+01011
+10011
+11000
+5
+01000
+10101
+01010
+00010
+01001
+5
+11001
+00000
+11111
+10110
+01111
diff --git a/MirrorGrid/main_output0.txt b/MirrorGrid/main_output0.txt
new file mode 100644
index 0000000..9944ffa
--- /dev/null
+++ b/MirrorGrid/main_output0.txt
@@ -0,0 +1,5 @@
+1
+0
+9
+7
+6
diff --git a/doubleStrings/main b/doubleStrings/main
new file mode 100755
index 0000000..c2ecd0d
--- /dev/null
+++ b/doubleStrings/main
Binary files differ
diff --git a/doubleStrings/main.cpp b/doubleStrings/main.cpp
new file mode 100644
index 0000000..532a4c5
--- /dev/null
+++ b/doubleStrings/main.cpp
@@ -0,0 +1,32 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n;
+ cin >> n;
+ vector<string> v(n);
+ for (auto &x : v)
+ cin >> x;
+ set<string> st(v.begin(), v.end());
+ string ans = "";
+ for (int i = 0; i < n; i++) {
+ int len = v[i].size();
+ bool ok = false;
+ for (int j = 0; j < len; j++) {
+ string prefix = v[i].substr(0, j + 1);
+ if (st.find(prefix) != st.end()) {
+ string suff = v[i].substr(j + 1);
+ ok = ok || st.find(suff) != st.end();
+ }
+ }
+ ans += ('0' + ok);
+ }
+ cout << ans << endl;
+ }
+}
diff --git a/doubleStrings/main_input0.txt b/doubleStrings/main_input0.txt
new file mode 100644
index 0000000..d988bc1
--- /dev/null
+++ b/doubleStrings/main_input0.txt
@@ -0,0 +1,20 @@
+3
+5
+abab
+ab
+abc
+abacb
+c
+3
+x
+xx
+xxx
+8
+codeforc
+es
+codes
+cod
+forc
+forces
+e
+code
diff --git a/doubleStrings/main_output0.txt b/doubleStrings/main_output0.txt
new file mode 100644
index 0000000..450a42b
--- /dev/null
+++ b/doubleStrings/main_output0.txt
@@ -0,0 +1,3 @@
+10100
+011
+10100101
diff --git a/icpcBallons/main b/icpcBallons/main
new file mode 100755
index 0000000..cde2feb
--- /dev/null
+++ b/icpcBallons/main
Binary files differ
diff --git a/icpcBallons/main.cpp b/icpcBallons/main.cpp
new file mode 100644
index 0000000..082df7c
--- /dev/null
+++ b/icpcBallons/main.cpp
@@ -0,0 +1,28 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ cin >> n;
+ string s;
+ cin >> s;
+ map<char, int> mp;
+ for(auto ch : s) {
+ mp[ch]++;
+ }
+ int ans = 0;
+ for(auto p : mp) {
+ if(p.second >= 2) {
+ ans += p.second - 1;
+ }
+ }
+ ans += mp.size() * 2;
+ cout << ans << endl;
+ }
+}
diff --git a/icpcBallons/main_input0.txt b/icpcBallons/main_input0.txt
new file mode 100644
index 0000000..c1839b2
--- /dev/null
+++ b/icpcBallons/main_input0.txt
@@ -0,0 +1,13 @@
+6
+3
+ABA
+1
+A
+3
+ORZ
+5
+BAAAA
+4
+BKPT
+10
+CODEFORCES
diff --git a/icpcBallons/main_output0.txt b/icpcBallons/main_output0.txt
new file mode 100644
index 0000000..b040190
--- /dev/null
+++ b/icpcBallons/main_output0.txt
@@ -0,0 +1,6 @@
+5
+2
+6
+7
+8
+17
diff --git a/yesOrYes/main b/yesOrYes/main
new file mode 100755
index 0000000..77ce258
--- /dev/null
+++ b/yesOrYes/main
Binary files differ
diff --git a/yesOrYes/main.cpp b/yesOrYes/main.cpp
new file mode 100644
index 0000000..04c4fd5
--- /dev/null
+++ b/yesOrYes/main.cpp
@@ -0,0 +1,22 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ string s;
+ cin >> s;
+ for(auto &c : s){
+ c = tolower(c);
+ }
+ if(s == "yes") {
+ cout << "YES" << endl;
+ } else {
+ cout << "NO" << endl;
+ }
+ }
+}
diff --git a/yesOrYes/main_input0.txt b/yesOrYes/main_input0.txt
new file mode 100644
index 0000000..b6e9152
--- /dev/null
+++ b/yesOrYes/main_input0.txt
@@ -0,0 +1,11 @@
+10
+YES
+yES
+yes
+Yes
+YeS
+Noo
+orZ
+yEz
+Yas
+XES
diff --git a/yesOrYes/main_output0.txt b/yesOrYes/main_output0.txt
new file mode 100644
index 0000000..1f336ce
--- /dev/null
+++ b/yesOrYes/main_output0.txt
@@ -0,0 +1,10 @@
+YES
+YES
+YES
+YES
+YES
+NO
+NO
+NO
+NO
+NO