QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#818978#7894. Many Many HeadsOIer_kzc#WA 0ms1452kbC++20774b2024-12-18 11:22:542024-12-18 11:22:55

Judging History

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

  • [2024-12-18 11:22:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1452kb
  • [2024-12-18 11:22:54]
  • 提交

answer

#include <stdio.h>
#include <string.h>
#include <assert.h>

#include <vector>
#include <algorithm>

#define LOG(FMT...) fprintf(stderr, FMT)

#define eb emplace_back

using namespace std;

typedef long long LL;
constexpr int N = 400005, M = 1000005;
constexpr int INF = 0x3f3f3f3f;

int n; char s[N];

bool chk() {
	for (int i = 1; i < n; ++i) {
		if (s[i] == s[i - 1]) {
			return false;
		}
	}
	for (int i = 0; i < n; ++i) {
		if (s[i] != s[2 * n - i - 1]) {
			return false;
		}
	}
	return true;
}

int main() {
	int task;
	for (scanf("%d", &task); task--; ) {
		scanf("%s", s), n = strlen(s);
		for (int i = 0; i < n; ++i) {
			s[i] = (s[i] == '(' || s[i] == ')');
		}
		n /= 2;
		puts(chk() ? "Yes" : "No");
	}
	return 0;
}

详细

Test #1:

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

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: 1424kb

input:

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

output:

No
No

result:

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