QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751528#7894. Many Many HeadsAzusidNyaWA 0ms3840kbC++17820b2024-11-15 19:15:582024-11-15 19:16:01

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 19:16:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-11-15 19:15:58]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define eb emplace_back
#define mp make_pair
#define DEBUG
using namespace std;
using pii = pair<int, int>;
using piii = pair<int, pii>;
using piiii = pair<pii, pii>;
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned int;
const int P = 998244353;const i64 inf = 0x3f3f3f3f3f3f3f3f;
namespace azus{
	int n;
	string s;
	int main(){
		cin >> s; n = s.length(); s = " " + s;
		for(int i = 1; i <= n / 2; i ++){
			if(s[i] == ')') s[i] = '(';
			if(s[i] == ']') s[i] = '[';
			if(s[i] == s[i - 1]) return cout << "No\n", 0;
		}
		cout << "Yes\n";
		return 0;
	}
}
signed main(){
#ifndef DEBUG
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
#endif
	int T = 1;
	cin >> T;
	while(T --)
		azus::main();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3532kb

input:

6
))
((()
[()]
()[()]()
([()])
([])([])

output:

Yes
No
Yes
No
Yes
No

result:

ok 6 token(s): yes count is 3, no count is 3

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

2
(([([[([
]]))])]])]

output:

No
No

result:

wrong answer expected YES, found NO [1st token]