QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100131 | #6320. Parallel Processing (Hard) | tikhon | WA | 2ms | 3488kb | C++17 | 3.4kb | 2023-04-24 19:14:26 | 2023-04-24 19:14:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ld long double
#define all(a) (a).begin(), (a).end()
vector<pair<int, pair<int, int>>> ans;
void add(string s, int st) {
stringstream ss(s);
int l;
ss >> l;
l *= 4;
while (l--) {
int a, b, c;
ss >> a >> b >> c;
ans.emplace_back(st + a, make_pair(st + b, st + c));
}
}
void solve(int n, int st) {
if (n == 1)
return;
if (n <= 2) {
add("1\n"\
"2 1 2\n"\
"3 3 3\n"\
"3 3 3\n"\
"3 3 3\n", st);
} else if (n <= 4) {
add("2\n"\
"2 1 2\n"\
"4 3 4\n"\
"5 5 5\n"\
"5 5 5\n"\
"3 2 3\n"\
"4 2 4\n"\
"5 5 5\n"\
"5 5 5\n", st);
} else if (n <= 8) {
add("3\n"\
"2 1 2\n"\
"4 3 4\n"\
"6 5 6\n"\
"8 7 8\n"\
"4 2 4\n"\
"8 6 8\n"\
"7 6 7\n"\
"3 2 3\n"\
"8 4 8\n"\
"7 4 7\n"\
"6 4 6\n"\
"5 4 5\n", st);
} else if (n <= 11) {
add("4\n"\
"2 1 2\n"\
"4 3 4\n"\
"6 5 6\n"\
"8 7 8\n"\
"4 2 4\n"\
"8 6 8\n"\
"3 2 3\n"\
"10 9 10\n"\
"5 4 5\n"\
"6 4 6\n"\
"11 10 11\n"\
"8 4 8\n"\
"7 6 7\n"\
"9 8 9\n"\
"10 8 10\n"\
"11 8 11\n", st);
} else if (n <= 13) {
add("5\n"\
"2 1 2\n"\
"4 3 4\n"\
"6 5 6\n"\
"8 7 8\n"\
"4 2 4\n"\
"8 6 8\n"\
"10 9 10\n"\
"12 11 12\n"\
"8 4 8\n"\
"12 10 12\n"\
"5 4 5\n"\
"3 2 3\n"\
"9 8 9\n"\
"10 8 10\n"\
"12 8 12\n"\
"6 4 6\n"\
"11 10 11\n"\
"13 12 13\n"\
"7 6 7\n"\
"20 20 20\n", st);
} else {
add("6\n"\
"2 1 2\n"\
"4 3 4\n"\
"6 5 6\n"\
"8 7 8\n"\
"4 2 4\n"\
"8 6 8\n"\
"10 9 10\n"\
"12 11 12\n"\
"8 4 8\n"\
"5 4 5\n"\
"6 4 6\n"\
"12 10 12\n"\
"9 8 9\n"\
"7 6 7\n"\
"14 13 14\n"\
"12 8 12\n"\
"10 8 10\n"\
"16 15 16\n"\
"13 12 13\n"\
"14 12 14\n"\
"11 10 11\n"\
"3 2 3\n"\
"15 14 15\n"\
"16 14 16\n", st);
solve(n - 15, st + 15);
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
solve(n, 0);
cout << ans.size() / 4 << '\n';
for (auto [a, bc] : ans)
cout << a << ' ' << bc.first << ' ' << bc.second << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3384kb
input:
17
output:
7 2 1 2 4 3 4 6 5 6 8 7 8 4 2 4 8 6 8 10 9 10 12 11 12 8 4 8 5 4 5 6 4 6 12 10 12 9 8 9 7 6 7 14 13 14 12 8 12 10 8 10 16 15 16 13 12 13 14 12 14 11 10 11 3 2 3 15 14 15 16 14 16 17 16 17 18 18 18 18 18 18 18 18 18
result:
ok AC
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3488kb
input:
18
output:
8 2 1 2 4 3 4 6 5 6 8 7 8 4 2 4 8 6 8 10 9 10 12 11 12 8 4 8 5 4 5 6 4 6 12 10 12 9 8 9 7 6 7 14 13 14 12 8 12 10 8 10 16 15 16 13 12 13 14 12 14 11 10 11 3 2 3 15 14 15 16 14 16 17 16 17 19 18 19 20 20 20 20 20 20 18 17 18 19 17 19 20 20 20 20 20 20
result:
wrong answer L = 8 is larger than 7