QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527260 | #6319. Parallel Processing (Easy) | solar_express# | RE | 0ms | 3692kb | C++14 | 1.0kb | 2024-08-22 13:14:09 | 2024-08-22 13:14:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct OPT{
int id;
int a[5],b[5],c[5];
}opt[8];
int n,top=0;
void sol(int l,int r){
if(r-l+1<=4){
//balabala
return ;
}
for(int i=l;i<=r;i+=4){
sol(i,i+3);
}
}
int pd[20];
void make_new(){
memset(pd,0,sizeof(pd));
top++;
opt[top].id=0;
for(int i=1;i<=4;i++){
opt[top].a[i]=opt[top].b[i]=opt[top].c[i]=2000;
}
}
void add(int c,int a,int b){
if(c>n)return ;
if(pd[a]||pd[b]||opt[top].id==4)make_new();
pd[c]=1;opt[top].id++;
opt[top].c[opt[top].id]=c;
opt[top].a[opt[top].id]=a;
opt[top].b[opt[top].id]=b;
}
void sol(int n){
top=0;
make_new();
for(int i=1;i<n;i+=2){
add(i+1,i,i+1);
}
for(int i=1;i<n;i+=4){
add(i+3,i+1,i+3);
add(i+2,i+1,i+2);
}
for(int i=4;i<n;i+=4){
add(i+4,i,i+4);
add(i+1,i,i+1);
add(i+2,i,i+2);
add(i+3,i,i+3);
}
cout<<top<<endl;
for(int i=1;i<=top;i++){
for(int j=1;j<=4;j++)
cout<<opt[i].c[j]<<" "<<opt[i].a[j]<<" "<<opt[i].b[j]<<endl;
}
}
int main(){
cin>>n;
sol(n);
if(n>10)return -1;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
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: 0ms
memory: 3520kb
input:
4
output:
2 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 4 2 4 3 2 3 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 3512kb
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: 3692kb
input:
5
output:
3 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 4 2 4 3 2 3 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: 3520kb
input:
6
output:
3 2 1 2 4 3 4 6 5 6 2000 2000 2000 4 2 4 3 2 3 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: 0ms
memory: 3684kb
input:
7
output:
3 2 1 2 4 3 4 6 5 6 2000 2000 2000 4 2 4 3 2 3 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: 3548kb
input:
8
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 4 2 4 3 2 3 8 6 8 7 6 7 8 4 8 5 4 5 6 4 6 7 4 7
result:
ok AC
Test #8:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
9
output:
4 2 1 2 4 3 4 6 5 6 8 7 8 4 2 4 3 2 3 8 6 8 7 6 7 8 4 8 5 4 5 6 4 6 7 4 7 9 8 9 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #9:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
10
output:
4 2 1 2 4 3 4 6 5 6 8 7 8 10 9 10 4 2 4 3 2 3 8 6 8 7 6 7 8 4 8 5 4 5 6 4 6 7 4 7 9 8 9 10 8 10 2000 2000 2000
result:
ok AC
Test #10:
score: -100
Runtime Error
input:
11
output:
5 2 1 2 4 3 4 6 5 6 8 7 8 10 9 10 4 2 4 3 2 3 8 6 8 7 6 7 11 10 11 8 4 8 5 4 5 6 4 6 7 4 7 9 8 9 10 8 10 11 8 11 2000 2000 2000 2000 2000 2000 2000 2000 2000