QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#92630#5528. Least Annoying Constructive ProblemlmeowdnWA 3ms5868kbC++141.2kb2023-03-30 19:59:192023-03-30 19:59:23

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-30 19:59:23]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5868kb
  • [2023-03-30 19:59:19]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define fi first
#define se second
#define eb emplace_back
#define popc __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef unsigned long long ull;
typedef long double ld;

int read() {
	int x=0,w=1; char c=getchar(); 
	while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
	while(isdigit(c)) {x=x*10+c-'0'; c=getchar();}
	return x*w;
}

const int N=509;

int n,a[N],tag,b[N],tot,m,c[N*N],d[N*N],vst[N],jt;

void check() {
	if(tag) n++;
	rep(i,1,n) vst[i]=0;
	rep(i,1,n-1) vst[c[i]]++, vst[d[i]]++;
	for(int i=n,j=1;i!=n-1;i=i%tot+1,j=j%tot+1) {
		vst[c[i]]++, vst[d[i]]++;
		vst[c[j]]--, vst[d[j]]--;
		rep(k,1,n) if(!vst[k]) {
			cerr<<"WA on "<<j+1<<" "<<i<<" "<<k<<endl;
		}
	}
}

signed main() {
	n=read(); if(n%2==0) m=n-1; else m=n;
	rep(i,1,m) {
		int x=i,y=i%m+1;
		rep(i,1,m/2) {
			++tot;
			c[tot]=x, d[tot]=y;
			x=(x+m-2)%m+1, y=y%m+1;
		}
		if(n%2==0) ++tot, c[tot]=x, d[tot]=n;
	}
	rep(i,1,tot) printf("%lld %lld\n",c[i],d[i]);
	check();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 5868kb

input:

3

output:

1 2
2 3
3 1

result:

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