QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#344581#5528. Least Annoying Constructive ProblemMeathermWA 1ms3828kbC++14871b2024-03-04 20:04:252024-03-04 20:04:25

Judging History

你现在查看的是最新测评结果

  • [2024-03-04 20:04:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3828kb
  • [2024-03-04 20:04:25]
  • 提交

answer

# include <bits/stdc++.h>

const int N=510,INF=0x3f3f3f3f;

inline int read(void){
	int res,f=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-') f=-1;
	res=c-48;
	while((c=getchar())>='0'&&c<='9')
		res=res*10+c-48;
	return res*f;
}

int n;

inline int conclo(int x){
	return (x==1)?n:(x-1);
}
inline int clo(int x){
	return (x==n)?1:(x+1);
}

inline void solve_odd(void){
	for(int i=1;i<=n;++i){
		int l=conclo(i),r=clo(i);
		for(int j=1;j<=n/2;++j) printf("%d %d\n",l,r),l=conclo(l),r=clo(r);
	}
	return;
} 

inline void solve_even(void){
	
	--n;
	
	for(int i=1;i<=n;++i){
		printf("%d %d\n",i,n+1);
		
		int l=conclo(i),r=clo(i);
		for(int j=1;j<=n/2;++j) printf("%d %d\n",l,r),l=conclo(l),r=clo(r);
	}
	
	
	return;
}

int main(void){
	n=read();
	
	if(n%2) solve_odd();
	else solve_even();


	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3828kb

input:

3

output:

3 2
1 3
2 1

result:

wrong answer Integer 2 violates the range [4, 3]