QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#795757 | #7894. Many Many Heads | imwinter# | WA | 0ms | 3560kb | C++20 | 1.8kb | 2024-12-01 00:10:34 | 2024-12-01 00:10:34 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<cstring>
#include<unordered_map>
#include<queue>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const int N = 1e5 + 10, MOD = 998244353, INF = 1e9 + 10, M = 11;
const double expp = 1e-6;
map<char, int>mp;
int n;
//bool check(string s) {
// stack<char> st;
// int cnt1 = 0, cnt2 = 0;
// for (int i = 1; i <= n - 1; i++) {
// if (mp[s[i]] == mp[s[i + 1]])cnt1++;
// }
// if (cnt1 > 2)return true;
// return false;
//}
//
////([()])([()])([()])
////
void solve() {
string s;
cin >> s;
//stack<pair<char, int>> st;
//n = s.size();
//mp['('] = 0; mp[')'] = 0;
//mp['['] = 1; mp[']'] = 1;
//s = " " + s;
//for (int i = 1; i <= n; i++) {
// if (!st.empty()&& mp[s[i]] == mp[st.top().first]) {
// char c = st.top().first;
// //cout << "This is ceshi\n";
// if (s[i] == c) {
// if (s[i] == ')')s[st.top().second] = '(';
// else if (s[i] == '(') {
// s[i] = ')';
// }
// else if (s[i] == ']')s[st.top().second] = '[';
// else if (s[i] == '[')s[i] = ']';
// }
// st.pop();
// }
// else st.push({ s[i],i });
//}
////cout << s << '\n';
//if (check(s))cout << "Yes";
int cnt = 0;
for (int i = 1; i < n; i++) {
if (s[i] == s[i + 1])cnt++;
}
if (cnt > 2)cout << "Yes\n";
else cout << "No\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3560kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
No No No No No No
result:
wrong answer expected YES, found NO [1st token]