QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54371#960. Output Limit ExceededtricyzhkxWA 112ms4088kbC++141.3kb2022-10-08 08:47:462022-10-08 08:47:49

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-08 08:47:49]
  • Judged
  • Verdict: WA
  • Time: 112ms
  • Memory: 4088kb
  • [2022-10-08 08:47:46]
  • Submitted

answer

# include <bits/stdc++.h>
using namespace std;
const int B=3000;
typedef long long ll;
bool ans[4000],vis[4000];
int mch[8000];
ll n;
vector<int> G[4000];
bool dfs(int u)
{
	if(vis[u]) return false;
	vis[u]=1;
	for(int v:G[u])
	{
		int w=mch[v];
		mch[u]=v;mch[v]=u;mch[w]=0;
		if(!w || dfs(w)) return true;
		mch[u]=0;mch[v]=w;mch[w]=v;
	}
	return false;
}
void solve(int K)
{
	for(int i=1;i<=K;i++)
	{
		G[i].push_back(K+n-n/i*i+1);
		for(int j=1;j<i;j++)
			if((n-i+1)%j==0) G[j].push_back(K+i);
		memset(vis,0,sizeof(vis));
		for(int j=1;j<=i;j++)
			if(!mch[j] && dfs(j))
				memset(vis,0,sizeof(vis));
		ans[i]=1;
		for(int j=1;j<=i;j++) ans[i]&=(mch[j]>0);
	}
}
int main()
{
	cin>>n;
	ans[0]=1;
	if(n<=2*B+1000)
	{
		solve(n/2);
		printf("2\n%lld ",n+1);
		for(int i=0;i<=n;i++)
			if(i<=n/2) printf("%d%c",ans[i]," \n"[i==n]);
			else printf("%d%c",ans[n-i]," \n"[i==n]);
		return 0;
	}
	solve(B);
	puts("61\n2 0 0");
	for(int i=3;i<=60;i++) printf("2 %d %d\n",i-1,i-1);
	vector<int> vec;
	for(int i=0;i<=B;i++) vec.push_back(ans[i]);
	ll len=n+1-2*B;
	for(int i=0;len;i++,len>>=1)
		if(len&1) vec.push_back(i?i+1:i);
	for(int i=B;i>=0;i--) vec.push_back(ans[i]);
	cout<<vec.size();
	for(int i:vec) printf(" %d",i);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3848kb

input:

1

output:

2
2 1 1

result:

ok OK 2 ones: 0 1

Test #2:

score: 0
Accepted
time: 2ms
memory: 3764kb

input:

0

output:

2
1 1

result:

ok OK 1 ones: 0

Test #3:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

7

output:

2
8 1 1 1 0 0 1 1 1

result:

ok OK 6 ones: 0 1 2 5 6 7

Test #4:

score: 0
Accepted
time: 3ms
memory: 3888kb

input:

1000

output:

2
1001 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok OK 18 ones: 0 1 2 3 4 5 6 7 9 991 993 994 995 996 997 998 999 1000

Test #5:

score: -100
Wrong Answer
time: 112ms
memory: 4088kb

input:

1000000000000000000

output:

61
2 0 0
2 2 2
2 3 3
2 4 4
2 5 5
2 6 6
2 7 7
2 8 8
2 9 9
2 10 10
2 11 11
2 12 12
2 13 13
2 14 14
2 15 15
2 16 16
2 17 17
2 18 18
2 19 19
2 20 20
2 21 21
2 22 22
2 23 23
2 24 24
2 25 25
2 26 26
2 27 27
2 28 28
2 29 29
2 30 30
2 31 31
2 32 32
2 33 33
2 34 34
2 35 35
2 36 36
2 37 37
2 38 38
2 39 39
2 4...

result:

wrong answer Answer doesn't look reasonable