diff options
Diffstat (limited to 'contests/filtrationContest/A')
| -rwxr-xr-x | contests/filtrationContest/A/main | bin | 0 -> 53504 bytes | |||
| -rw-r--r-- | contests/filtrationContest/A/main.cpp | 33 | ||||
| -rw-r--r-- | contests/filtrationContest/A/main_input0.txt | 11 | ||||
| -rw-r--r-- | contests/filtrationContest/A/main_output0.txt | 5 |
4 files changed, 49 insertions, 0 deletions
diff --git a/contests/filtrationContest/A/main b/contests/filtrationContest/A/main Binary files differnew file mode 100755 index 0000000..1061a17 --- /dev/null +++ b/contests/filtrationContest/A/main diff --git a/contests/filtrationContest/A/main.cpp b/contests/filtrationContest/A/main.cpp new file mode 100644 index 0000000..5968cb2 --- /dev/null +++ b/contests/filtrationContest/A/main.cpp @@ -0,0 +1,33 @@ +#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; + bool sus = false; + for (int i = 0; i < n - 1; i++) { + if(s[i] == s[i + 1]) { + s[i] = '.'; + } + } + map<int, int> fq; + for (auto ch : s) { + fq[ch]++; + } + for (auto [key, val] : fq) { + if (val > 1 && key != '.') { + sus = true; + break; + } + } + cout << (!sus ? "YES" : "NO") << '\n'; + } +} diff --git a/contests/filtrationContest/A/main_input0.txt b/contests/filtrationContest/A/main_input0.txt new file mode 100644 index 0000000..4fdafa4 --- /dev/null +++ b/contests/filtrationContest/A/main_input0.txt @@ -0,0 +1,11 @@ +5 +3 +ABA +11 +DDBBCCCBBEZ +7 +FFGZZZY +1 +Z +2 +AB diff --git a/contests/filtrationContest/A/main_output0.txt b/contests/filtrationContest/A/main_output0.txt new file mode 100644 index 0000000..7957a10 --- /dev/null +++ b/contests/filtrationContest/A/main_output0.txt @@ -0,0 +1,5 @@ +NO +NO +YES +YES +YES |
