QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#426439 | #6319. Parallel Processing (Easy) | james1BadCreeper | WA | 1ms | 3608kb | C++17 | 2.2kb | 2024-05-31 11:17:06 | 2024-05-31 11:17:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int id, n, I, be = 5;
vector<tuple<int, int, int>> ans;
inline int get(int x) {
if (x % 4 == 1) return x - 1;
if (x % 4 == 2) return x - 2;
if (x % 4 == 3) return x - 3;
return x - 4;
}
int over = 4;
inline void mkans(void) {
if (get(be) <= over && be < I) {
ans.emplace_back(be, get(be), be);
++be;
} else ans.emplace_back(2000, 2000, 2000);
}
int main(void) {
ios::sync_with_stdio(0);
cin >> id >> n;
// cin >> n;
int I, be = 5;
for (I = 1; I + 3 - 1 <= n; I += 8) {
ans.emplace_back(I + 1, I, I + 1);
if (I + 3 <= n) ans.emplace_back(I + 3, I + 2, I + 3);
else mkans();
if (I + 1 + 4 <= n) ans.emplace_back(I + 1 + 4, I + 4, I + 1 + 4);
else mkans();
if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 2 + 4, I + 3 + 4);
else mkans();
over = be;
ans.emplace_back(I + 2, I + 1, I + 2);
if (I + 3 <= n) ans.emplace_back(I + 3, I + 1, I + 3);
else mkans();
if (I + 2 + 4 <= n) ans.emplace_back(I + 2 + 4, I + 1 + 4, I + 2 + 4);
else mkans();
if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 1 + 4, I + 3 + 4);
else mkans();
over = be;
}
if (I < n) {
ans.emplace_back(I + 1, I, I + 1);
mkans(); mkans(); mkans(); over = be;
}
// cerr << ans.size() << "\n";
int cnt = 0;
while (be % 4 != 1) ans.emplace_back(be, get(be), be), ++be, ++cnt;
while (cnt != 0 && cnt != 4) ans.emplace_back(2000, 2000, 2000), ++cnt;
for (; be <= n; be += 4) {
ans.emplace_back(be, get(be), be);
if (be + 1 <= n) ans.emplace_back(be + 1, get(be + 1), be + 1);
else ans.emplace_back(2000, 2000, 2000);
if (be + 2 <= n) ans.emplace_back(be + 2, get(be + 2), be + 2);
else ans.emplace_back(2000, 2000, 2000);
if (be + 3 <= n) ans.emplace_back(be + 3, get(be + 3), be + 3);
else ans.emplace_back(2000, 2000, 2000);
}
cout << ans.size() / 4 << "\n";
for (auto [i, j, k] : ans) cout << i << " " << j << " " << k << "\n";
return 0;
}
/*
19
27
35
43
*/
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3608kb
input:
2
output:
0
result:
wrong answer A[2] is not (1, …, 2)