QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#99527 | #6319. Parallel Processing (Easy) | Sorting# | WA | 2ms | 3436kb | C++23 | 3.1kb | 2023-04-22 21:16:41 | 2023-04-22 21:16:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> void check_min(T &a, const T &b){ a = (a < b) ? a : b; }
template<class T> void check_max(T &a, const T &b){ a = (a > b) ? a : b; }
#define all(x) (x).begin(), (x).end()
void output(vector<vector<array<int, 3>>> ins){
cout << ins.size() << "\n";
for(auto v: ins){
for(auto [a, b, c]: v)
cout << a << " " << b << " " << c << "\n";
}
exit(0);
}
void fix_add(vector<array<int, 3>> &add){
while(add.size() != 4){
add.push_back({2000, 2000, 2000});
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<vector<array<int, 3>>> ins{
{
{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},
}
};
if(n <= 8){
if(n <= 2){
ins.resize(1);
output(ins);
}
if(n <= 4){
ins.resize(2);
output(ins);
}
output(ins);
}
int start = 9;
for(int d = 1; d <= 4; d *= 2){
vector<array<int, 3>> add;
if(d == 1){
for(int x: vector{9, 11,13,15}){
if(x + 1 > n) break;
add.push_back({x + 1, x, x + 1});
}
for(int x = start; add.size() != 4 && x <= min(n, 9); ++x){
add.push_back({x, 8, x});
++start;
}
}
else if(d == 2){
for(int x: vector{10, 14}){
for(int i = 1; i <= 2; ++i){
if(x + i > n) break;
add.push_back({x + i, x, x + i});
}
}
for(int x = start; add.size() != 4 && x <= min(n, 10); ++x){
add.push_back({x, 8, x});
++start;
}
}
else if(d == 4){
for(int x: vector{12}){
for(int i = 1; i <= 4; ++i){
if(x + i > n) break;
add.push_back({x + i, x, x + i});
}
}
for(int x = start; add.size() != 4 && x <= min(n, 12); ++x){
add.push_back({x, 8, x});
++start;
}
}
if(add.empty()) continue;
fix_add(add);
ins.push_back(add);
}
{
vector<array<int, 3>> add;
for(int i = start; i <= min(start + 3, n); ++i){
add.push_back({i, 8, i});
}
start += 4;
if(!add.empty()){
fix_add(add);
ins.push_back(add);
}
add.clear();
for(int i = start; i <= min(start + 3, n); ++i){
add.push_back({i, 8, i});
}
if(!add.empty()){
fix_add(add);
ins.push_back(add);
}
}
output(ins);
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3416kb
input:
2
output:
1 2 1 2 4 3 4 6 5 6 8 7 8
result:
ok AC
Test #2:
score: 0
Accepted
time: 2ms
memory: 3352kb
input:
4
output:
2 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 3404kb
input:
3
output:
2 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8
result:
ok AC
Test #4:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
5
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 #5:
score: 0
Accepted
time: 1ms
memory: 3344kb
input:
6
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 #6:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
7
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 #7:
score: 0
Accepted
time: 0ms
memory: 3352kb
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: 2ms
memory: 3436kb
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: 2ms
memory: 3356kb
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 5 4 5 6 4 6 7 4 7 8 4 8 10 9 10 9 8 9 2000 2000 2000 2000 2000 2000 10 8 10 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
wrong answer L = 5 is larger than 4