QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#944 | #353627 | #8328. A Good Problem | Fei | ucup-team004 | Failed. | 2024-10-09 21:51:42 | 2024-10-09 21:51:44 |
Details
Extra Test:
Invalid Input
input:
jiangly
output:
result:
FAIL Expected integer, but "jiangly" found (stdin, line 1)
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}