QOJ.ac
QOJ
ID | 提交记录ID | 题目 | Hacker | Owner | 结果 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|
#944 | #353627 | #8328. A Good Problem | Fei | ucup-team004 | Failed. | 2024-10-09 21:51:42 | 2024-10-09 21:51:44 |
详细
Extra Test:
Invalid Input
input:
jiangly
output:
result:
FAIL Expected integer, but "jiangly" found (stdin, line 1)
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#353627 | #8328. A Good Problem | ucup-team004# | AC ✓ | 3ms | 3920kb | C++20 | 939b | 2024-03-14 13:38:18 | 2024-03-14 13:38:19 |
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> b(n);
for (int i = 0; i < n; i++) {
std::cin >> b[i];
}
std::vector<std::pair<int, int>> ans;
auto work = [&](auto self, int l, int r) -> void {
if (r - l == 1) {
return;
}
int m = (l + r) / 2;
for (int i = 0; i < n; i++) {
if (m <= b[i] && b[i] < r) {
ans.emplace_back(2, i + 1);
}
}
for (int i = l + 1; i < m; i++) {
ans.emplace_back(1, i);
}
self(self, l, m);
self(self, m, r);
};
work(work, 0, n + 1);
std::cout << ans.size() << "\n";
for (auto [x, y] : ans) {
std::cout << x << " " << y << "\n";
}
return 0;
}