QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#35250#960. Output Limit ExceededFroggyguaWA 25ms3668kbC++171.5kb2022-06-14 19:27:372022-06-14 19:27:38

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-06-14 19:27:38]
  • Judged
  • Verdict: WA
  • Time: 25ms
  • Memory: 3668kb
  • [2022-06-14 19:27:37]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define N 205
typedef long long ll;
ll n;
int match[N];
bool G[N][N];
bool vis[N];
bool dfs(int u,int n){
	for(int v=1;v<=n;++v){
		if(vis[v]||!G[u][v])continue;
		vis[v]=1;
		if(!match[v]||dfs(match[v],n)){
			match[v]=u;
			return true;
		}
	}
	return false;
}
bool check(int n){
	memset(match,0,sizeof(match));
	for(int i=1;i<=n;++i){
		memset(vis,0,sizeof(vis));
		if(!dfs(i,n))return false;
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	vector<int> ans;
	for(int i=0;i<=min(200LL,n);++i){
		memset(G,false,sizeof(G));
		for(int u=1;u<=i;++u){
			for(int v=1;v<=i;++v){
				if((n-u+1)%v==0){
					G[u][v]=1;
				}
			}
		}
		ans.push_back(check(i));
	}
	if(n<=400){
		for(int i=(int)ans.size();i<=n;++i){
			ans.push_back(ans[n-i]);
		}
		cout<<2<<'\n';
		cout<<ans.size()<<' ';
		for(auto x:ans)cout<<x<<' ';
		cout<<'\n';
	}
	else{
		cout<<64<<'\n';
		for(int i=1;i<=60;++i){
			cout<<2<<' '<<(i==1?0:i)<<' '<<(i==1?0:i)<<'\n';
		}
		cout<<ans.size()<<' ';
		for(auto x:ans)cout<<x<<' ';
		cout<<'\n';
		reverse(ans.begin(),ans.end());
		cout<<ans.size()<<' ';
		for(auto x:ans)cout<<x<<' ';
		cout<<'\n';
		vector<int> jb({62});
		ll rem=n-2*ans.size();
		for(int i=0;i<=60;++i){
			if(rem>>i&1){
				jb.push_back(!i?0:i+1);
			}
		}
		jb.push_back(63);
		cout<<jb.size()<<' ';
		for(auto x:jb)cout<<x<<' ';
		cout<<'\n';
	}
	return 0;
}



詳細信息

Test #1:

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

input:

1

output:

2
2 1 1 

result:

ok OK 2 ones: 0 1

Test #2:

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

input:

0

output:

2
1 1 

result:

ok OK 1 ones: 0

Test #3:

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

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: -100
Wrong Answer
time: 25ms
memory: 3536kb

input:

1000

output:

64
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 the length of the answer should be n+1