QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#426429 | #6319. Parallel Processing (Easy) | james1BadCreeper | WA | 1ms | 3740kb | C++17 | 3.2kb | 2024-05-31 10:56:01 | 2024-05-31 10:56:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int id, n;
vector<tuple<int, int, int>> ans;
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 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 {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
if (I + 1 + 4 <= n) ans.emplace_back(I + 1 + 4, I + 4, I + 1 + 4);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 2 + 4, I + 3 + 4);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
ans.emplace_back(I + 2, I + 1, I + 2);
if (I + 3 <= n) ans.emplace_back(I + 3, I + 1, I + 3);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
if (I + 2 + 4 <= n) ans.emplace_back(I + 2 + 4, I + 1 + 4, I + 2 + 4);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 1 + 4, I + 3 + 4);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
}
if (I < n) {
ans.emplace_back(I + 1, I, I + 1);
if (I + 2 <= n)
ans.emplace_back(I + 2, I, I + 2),
ans.emplace_back(I + 2, I + 1, I + 2);
else {
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
if (be < I) ans.emplace_back(be, get(be), be), ++be;
else ans.emplace_back(2000, 2000, 2000);
}
// 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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3692kb
input:
2
output:
1 2 1 2 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #2:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
4
output:
2 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 3 2 3 4 2 4 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #3:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
3
output:
2 2 1 2 2000 2000 2000 2000 2000 2000 2000 2000 2000 3 2 3 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #4:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
5
output:
3 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 3 2 3 4 2 4 2000 2000 2000 2000 2000 2000 5 4 5 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #5:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
6
output:
3 2 1 2 4 3 4 6 5 6 2000 2000 2000 3 2 3 4 2 4 2000 2000 2000 2000 2000 2000 5 4 5 6 4 6 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #6:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
7
output:
3 2 1 2 4 3 4 6 5 6 2000 2000 2000 3 2 3 4 2 4 7 6 7 2000 2000 2000 5 4 5 6 4 6 7 4 7 2000 2000 2000
result:
ok AC
Test #7:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
8
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8
result:
ok AC
Test #8:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
9
output:
4 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8 9 8 9 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
10
output:
5 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 10 9 10 5 4 5 6 4 6 7 4 7 8 4 8 2000 2000 2000 2000 2000 2000 2000 2000 2000 9 8 9 10 8 10 2000 2000 2000 2000 2000 2000
result:
wrong answer L = 5 is larger than 4