QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#686772#9176. Non-Interactive Nimucup-team4975#WA 0ms3548kbC++231.4kb2024-10-29 15:38:122024-10-29 15:38:14

Judging History

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

  • [2024-10-29 15:38:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3548kb
  • [2024-10-29 15:38:12]
  • 提交

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
	cerr << setw(4) << #x << ":: "; \
	for (auto i : x)                \
		cerr << i << " ";           \
	cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
	out << x.fir << " " << x.sec << endl;
	return out;
}

const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;
void solve()
{
	int n;
	cin >> n;
	vector<int> a(n + 5, 0);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	vector<PII> ans;
	for (ll i = 60; i >= 0; i--) {
		vector<int> v;
		for (int j = 1; j <= n; j++) {
			if (a[j] >> i & 1) {
				v.push_back(j);
			}
		}
		if (v.size() == 2) {
			ans.push_back(PII(v[0], v[1]));
		}
		else if (v.size() == 0) {
			continue;
		}
		else {
			cout << "-1" << el;
			return;
		}
	}
	cout << ans.size() << el;
	for (auto [x, y] : ans) {
		cout << x << " " << y << el;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3548kb

input:

2
4
4 2 7 1
4
1 1 1 1

output:

6
1 3
2 3
3 4
1 3
2 3
3 4
-1

result:

wrong answer Integer parameter [name=x] equals to 3, violates the range [1, 2] (test case 1)