QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#351107#4415. Spanning Tree GamettestWA 2008ms17776kbC++142.0kb2024-03-11 15:45:202024-03-11 15:45:20

Judging History

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

  • [2024-03-11 15:45:20]
  • 评测
  • 测评结果:WA
  • 用时:2008ms
  • 内存:17776kb
  • [2024-03-11 15:45:20]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define pii pair<int,int>
#define isz(v) (int)(v.size())
using namespace std;

const int maxs=22005;
const int maxn=11;
const int maxm=105;
const int inf=0x3f3f3f3f;

namespace Solve {
	int n,m;
	int cnt;
	array<int,maxn> b;
	array<int,maxn> all[maxs];
	map<array<int,maxn>,int> id;
	int to[maxs][maxn][maxn];
	int f[maxs][maxm];
	int g[maxs][maxm];
	void clear() {
		cnt=0;
		id.clear();
		memset(to,0,sizeof(to));
	}
	void pre(int x,int c) {
		if(x==n+1) {
			all[++cnt]=b;
			id[b]=cnt;
			return ;
		}
		for(int i=1;i<=c;i++) {
			b[x]=i;
			pre(x+1,c+(i==c));
		}
	}
	array<int,maxn> deal(array<int,maxn> v) {
		int cnt=0;
		array<int,maxn> vis={};
		for(int i=1;i<=n;i++) {
			if(!vis[v[i]]) {
				vis[v[i]]=++cnt;
			}
			v[i]=vis[v[i]];
		}
		return v;
	}
	void ckmax(int &x,int y) {
		x=max(x,y);
	}
	void main(int tid) {
		cin>>n>>m;
		pre(1,1);
		for(int s=1;s<=cnt;s++) {
			for(int i=1;i<=n;i++) {
				for(int j=1;j<=n;j++) {
					if(all[s][i]==all[s][j]) {
						continue;
					}
					auto c=all[s];
					for(int k=1;k<=n;k++) {
						if(c[k]==all[s][j]) {
							c[k]=all[s][i];
						}
					}
					to[s][i][j]=id[deal(c)];
				}
			}
		}
		int ex=0;
		vector<array<int,4>> es;
		for(int i=1;i<=m;i++) {
			int x,y,a,b;
			cin>>x>>y>>a>>b;
			if(a<=b) {
				es.push_back({a,0,x,y});
				es.push_back({b,2,x,y});
			} else {
				ex++;
				es.push_back({b,1,x,y});
				es.push_back({a,2,x,y});
			}
		}
		sort(es.begin(),es.end());
		for(int i=0;i<=m;i++) {
			cout<<f[1][i]<<"\n";
		}
	}
	void init() {
		
	}
}

signed main() {
//	freopen("mst.in","r",stdin);
//	freopen("mst.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	Solve::init();
	for(int t=1;t<=T;t++) {
		Solve::main(t);
		Solve::clear();
	}
#ifndef ONLINE_JUDGE
	cerr<<"Time: "<<clock()<<"ms\n";
#endif
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2008ms
memory: 17776kb

input:

20
6 15
1 2 425701 295238
1 3 874429 832238
1 4 910055 724812
1 5 678236 579704
1 6 717810 210509
2 3 333736 610246
2 4 894560 510280
2 5 899852 32693
2 6 510171 259125
3 4 673744 422164
3 5 612935 260549
3 6 776617 404367
4 5 781488 292686
4 6 335747 589598
5 6 364028 76718
7 21
1 2 838601 742089
1...

output:

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
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '873155', found: '0'