救救孩子吧
查看原帖
救救孩子吧
766220
Transparent_fish楼主2024/11/1 15:01

样例过了,全WA,救救孩子吧

#include <bits/stdc++.h>
using namespace std;
int q, n, a, b[100000000], c[100000000];

int main() {
	stack<int> s;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> n;
		cin >> a;
		s.push(a);
		a = 0;
		for (int j = 0; j < n; j++) {
			cin >> b[j];
		}
		for (int j2 = 0; j2 < n; j2++) {
			c[j2] = s.top();
		}
		for (int j3 = 0; j3 < n; j3++) {
			for (int j4 = 0; j4 < n; j4++) {
				if (b[j3] == b[j4]) {
					cout << "Yes\n";
					break;
				} else {
					cout << "No\n";
					return 0;
				}
			}
		}
	}
	return 0;
}
2024/11/1 15:01
加载中...