QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#193280 | #6319. Parallel Processing (Easy) | fz_zsl | WA | 0ms | 3952kb | C++14 | 5.6kb | 2023-09-30 16:48:12 | 2023-09-30 16:48:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize(2)
#define LL long long
#define uLL unsigned long long
#define re register
#define LD __float128
#define DB double
#define ci const int
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pll pair<LL,LL>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define UI unsigned int
#define Int __int128
#define N 100005
// #define getchar gc
char gc() {
// return getchar();
const int SZ = 1 << 17;
static char buf[SZ], *S, *T;
if(S == T) T = (S = buf) + fread(buf, 1, SZ, stdin);
return S == T ? EOF : *S ++;
}
void cmax(int& a,int b){
(a<b)&&(a=b);
}
void cmin(int& a,int b){
(a>b)&&(a=b);
}
void Read(int& a){
char c=a=0,f=0;
while(c<'0'||c>'9')c=getchar(),f|=c=='-';
while(c>='0'&&c<='9')a=(a*10)+(c^'0'),c=getchar();
f&&(a=-a);
}
void Read(LL& a){
char c=a=0,f=0;
while(c<'0'||c>'9')c=getchar(),f|=c=='-';
while(c>='0'&&c<='9')a=(a*10)+(c^'0'),c=getchar();
f&&(a=-a);
}
char Ssr[20];
void Print(LL a,char c='\n'){
// cerr<<a<<endl;
if(a<0)putchar('-'),a=-a;
int len=0;
while(a)Ssr[++len]='0'^(a%10),a/=10;
len==0&&(Ssr[++len]='0');
while(len)putchar(Ssr[len--]);
putchar(c);
}
void cmax(LL& a,LL b){
a<b&&(a=b);
}
void cmin(LL& a,LL b){
a>b&&(a=b);
}
LL Rand(LL res=0,int len=12){
for(;len;--len)res=res*10+rand()%10;
return res;
}
bool Bar;
ci mo=998244353;
int Val[]={0,1,2,2,3,4,4,4},x=2000,y=1999,n,m;
bool Ka;//real,imag
int Pow(int a,int b=mo-2){
int res=1;
for(;b;b>>=1,a=1ll*a*a%mo)(b&1)&&(res=1ll*res*a%mo);
return res;
}
int main() {
// printf("Memory:%lf\n",(&Ka-&Bar)/1024.0/1024.0);
// freopen("A.in","r",stdin);
// freopen("A.out","w",stdout);
scanf("%d",&n);
m=n-(n&7);
if(n<8){
if(n==1)puts("0");
else if(n==2){
puts("1");
puts("2 1 2");
puts("20 19 20");
puts("20 19 20");
puts("20 19 20");
}else if(n==3){
puts("2");
puts("2 1 2");
puts("20 19 20");
puts("20 19 20");
puts("20 19 20");
puts("3 2 3");
puts("20 19 20");
puts("20 19 20");
puts("20 19 20");
}else if(n==4){
puts("2");
puts("2 1 2");
puts("4 3 4");
puts("20 19 20");
puts("20 19 20");
puts("3 2 3");
puts("4 2 4");
puts("20 19 20");
puts("20 19 20");
}else if(n==5){
puts("3");
puts("2 1 2");
puts("4 3 4");
puts("20 19 20");
puts("20 19 20");
puts("3 2 3");
puts("4 2 4");
puts("20 19 20");
puts("20 19 20");
puts("5 4 5");
puts("20 19 20");
puts("20 19 20");
puts("20 19 20");
}else if(n==6){
puts("3");
puts("2 1 2");
puts("4 3 4");
puts("6 5 6");
puts("20 19 20");
puts("3 2 3");
puts("4 2 4");
puts("20 19 20");
puts("20 19 20");
puts("5 4 5");
puts("6 4 6");
puts("20 19 20");
puts("20 19 20");
}else if(n==7){
puts("3");
puts("2 1 2");
puts("4 3 4");
puts("6 5 6");
puts("20 19 20");
puts("3 2 3");
puts("4 2 4");
puts("7 6 7");
puts("20 19 20");
puts("5 4 5");
puts("6 4 6");
puts("7 4 7");
puts("20 19 20");
}
}else if(n<=9||n>10){
if(n-m>4)m+=8;
printf("%d\n",m/2-1+(n>m?Val[n-m]:0));
for(int i=0;i<m;i+=8){
printf("%d %d %d\n",i+2,i+1,i+2);
printf("%d %d %d\n",i+4,i+3,i+4);
printf("%d %d %d\n",i+6,i+5,i+6);
printf("%d %d %d\n",i+8,i+7,i+8);
printf("%d %d %d\n",i+3,i+2,i+3);
printf("%d %d %d\n",i+4,i+2,i+4);
printf("%d %d %d\n",i+7,i+6,i+7);
printf("%d %d %d\n",i+8,i+6,i+8);
}
for(int i=4;i<m;i+=4){
printf("%d %d %d\n",i+1,i,i+1);
printf("%d %d %d\n",i+2,i,i+2);
printf("%d %d %d\n",i+3,i,i+3);
printf("%d %d %d\n",i+4,i,i+4);
}
if(n-m==1){
printf("%d %d %d\n",m+1,m,m+1);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
}else if(n-m==2){
printf("%d %d %d\n",m+1,m,m+1);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",m+2,m+1,m+2);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
}else if(n-m==3){
printf("%d %d %d\n",m+1,m,m+1);
printf("%d %d %d\n",m+3,m+2,m+3);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",m+2,m+1,m+2);
printf("%d %d %d\n",m+3,m+1,m+3);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
}else if(n-m==4){
printf("%d %d %d\n",m+2,m+1,m+2);
printf("%d %d %d\n",m+4,m+3,m+4);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",m+3,m+2,m+3);
printf("%d %d %d\n",m+4,m+2,m+4);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",x,y,x);
printf("%d %d %d\n",m+1,m,m+1);
printf("%d %d %d\n",m+2,m,m+2);
printf("%d %d %d\n",m+3,m,m+3);
printf("%d %d %d\n",m+4,m,m+4);
}
}else if(n==10){
int i=1;
puts("4");
printf("%d %d %d\n",i+1,i,i+1);
printf("%d %d %d\n",i+3,i+2,i+3);
printf("%d %d %d\n",i+6,i+5,i+6);
printf("%d %d %d\n",i+8,i+7,i+8);
printf("%d %d %d\n",i+2,i+1,i+2);
printf("%d %d %d\n",i+3,i+1,i+3);
printf("%d %d %d\n",i+5,i+4,i+5);
printf("%d %d %d\n",i+6,i+4,i+6);
printf("%d %d %d\n",i+4,i+3,i+4);
printf("%d %d %d\n",i+5,i+3,i+5);
printf("%d %d %d\n",i+6,i+3,i+6);
printf("%d %d %d\n",i+9,i+8,i+9);
printf("%d %d %d\n",i+7,i+6,i+7);
printf("%d %d %d\n",i+8,i+6,i+8);
printf("%d %d %d\n",i+9,i+6,i+9);
printf("%d %d %d\n",x,y,x);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3764kb
input:
2
output:
1 2 1 2 20 19 20 20 19 20 20 19 20
result:
ok AC
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
4
output:
2 2 1 2 4 3 4 20 19 20 20 19 20 3 2 3 4 2 4 20 19 20 20 19 20
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
3
output:
2 2 1 2 20 19 20 20 19 20 20 19 20 3 2 3 20 19 20 20 19 20 20 19 20
result:
ok AC
Test #4:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
5
output:
3 2 1 2 4 3 4 20 19 20 20 19 20 3 2 3 4 2 4 20 19 20 20 19 20 5 4 5 20 19 20 20 19 20 20 19 20
result:
ok AC
Test #5:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
6
output:
3 2 1 2 4 3 4 6 5 6 20 19 20 3 2 3 4 2 4 20 19 20 20 19 20 5 4 5 6 4 6 20 19 20 20 19 20
result:
ok AC
Test #6:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
7
output:
3 2 1 2 4 3 4 6 5 6 20 19 20 3 2 3 4 2 4 7 6 7 20 19 20 5 4 5 6 4 6 7 4 7 20 19 20
result:
ok AC
Test #7:
score: 0
Accepted
time: 0ms
memory: 3752kb
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: 3912kb
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 1999 2000 2000 1999 2000 2000 1999 2000
result:
ok AC
Test #9:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
10
output:
4 2 1 2 4 3 4 7 6 7 9 8 9 3 2 3 4 2 4 6 5 6 7 5 7 5 4 5 6 4 6 7 4 7 10 9 10 8 7 8 9 7 9 10 7 10 2000 1999 2000
result:
ok AC
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3952kb
input:
11
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 9 8 9 11 10 11 2000 1999 2000 2000 1999 2000 10 9 10 11 9 11 2000 1999 2000 2000 1999 2000
result:
wrong answer L = 5 is larger than 4