QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#87937#960. Output Limit ExceededCrysflyWA 110ms3980kbC++141.6kb2023-03-14 21:18:222023-03-14 21:18:25

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.
  • [2023-03-14 21:18:25]
  • Judged
  • Verdict: WA
  • Time: 110ms
  • Memory: 3980kb
  • [2023-03-14 21:18:22]
  • Submitted

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return f?-x:x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 6005
#define inf 0x3f3f3f3f

int n,res[maxn];
vi e[maxn];
int bel[maxn];
bool vis[maxn];
bool dfs(int u){
	if(vis[u])return 0; vis[u]=1;
	for(int v:e[u]){
		int w=bel[v];
		bel[u]=v,bel[v]=u;
		if(!w)return 1;
		bel[w]=0;
		if(dfs(w))return 1;
		bel[u]=0,bel[v]=w,bel[w]=v;
	}return 0;
}
void solve(int m)
{
	res[0]=1;
	For(i,1,m){
		e[i].pb(m+(n-n/i*i)+1);
		For(j,1,i-1) if((n-i+1)%j==0) e[j].pb(m+i);
		memset(vis,0,sizeof vis);
		For(j,1,i)
			if(!bel[j] && dfs(j)) memset(vis,0,sizeof vis);
		bool ok=1;
		For(j,1,i)if(!bel[j]){ok=0;break;}
		res[i]=ok;
	}
}
void brute(){
	solve(n/2);
	cout<<2<<"\n"<<n+1<<' ';
	For(i,0,n)if(i<=n/2)cout<<res[i]<<' ';else cout<<res[n-i]<<" "; exit(0);
}
vi o;
void qwq(int n){
	Rep(i,60,0)
		if(n>>i&1){
			if(!i)o.pb(0);
			else o.pb(i);
		}
}
signed main()
{
	n=read();
	if(n<=6005)brute();
	solve(3000);
	cout<<61<<"\n";
	cout<<"2 0 0\n";
	For(i,3,60)cout<<2<<" "<<i-1<<" "<<i-1<<"\n";
	For(i,0,3000)o.pb(res[i]);
	qwq(n-2*3000-1);
	Rep(i,3000,0)o.pb(res[i]);
	cout<<o.size()<<" ";
	for(int x:o)cout<<x<<" ";
	return 0;
}

詳細信息

Test #1:

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

input:

1

output:

2
2 1 1 

result:

ok OK 2 ones: 0 1

Test #2:

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

input:

0

output:

2
1 1 

result:

ok OK 1 ones: 0

Test #3:

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

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: 2ms
memory: 3656kb

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: 110ms
memory: 3980kb

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