QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692677#5520. Distance ParitiesLinkWishWA 0ms3564kbC++141.6kb2024-10-31 14:54:012024-10-31 14:54:22

Judging History

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

  • [2024-10-31 14:54:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3564kb
  • [2024-10-31 14:54:01]
  • 提交

answer

//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
#define si inline
using namespace std;
typedef long long ll;typedef __int128 li;typedef long double ld;
typedef unsigned long long ull;typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef const int ci;typedef const ll cl;ci iinf=INT_MAX;cl linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,true;return false;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,true;return false;}

namespace LinkWish{

	ci N=505;

	int n;
	bool e[N][N];

	int dis[N];
	void bfs(int s){
		for(int i=1;i<=n;i++)dis[i]=-1;
		queue<int> q;
		q.push(s),dis[s]=0;
		while(!q.empty()){
			int now=q.front();q.pop();
			for(int i=1;i<=n;i++)
				if(e[now][i]&&dis[i]==-1)dis[i]=dis[now]+1,q.push(i);
		}
	}

	si void solve(){
		cin>>n;
		for(int i=1;i<=n;i++){
			string s;cin>>s;
			for(int j=1;j<=n;j++){
				e[i][j]=(s[j-1]=='1');
			}
		}
		for(int i=1;i<=n;i++){
			bfs(i);
			for(int j=1;j<=n;j++)
				if((int)e[i][j]!=(dis[j]&1)||dis[j]==-1)
					return cout<<"Track Lost\n",void();
		}
		cout<<"Pure Memory\n";
		vector<pii> edge;
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				if(e[i][j])edge.emplace_back(i,j);
		cout<<edge.size()<<endl;
		for(pii i:edge)cout<<i.fi<<' '<<i.se<<endl;
	}

	void mian(){
		int TT;cin>>TT;
		while(TT--)solve();
	}
}

signed main(){
	#ifndef ONLINE_JUDGE
	assert(freopen("bridge.in","r",stdin));
	assert(freopen("bridge.out","w",stdout));
	#endif
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	LinkWish::mian();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

input:

3
3
011
101
110
4
0100
1000
0001
0010
5
01010
10101
01010
10101
01010

output:

Pure Memory
3
1 2
1 3
2 3
Track Lost
Pure Memory
6
1 2
1 4
2 3
2 5
3 4
4 5

result:

wrong answer Token parameter [name=yes/no] equals to "Pure", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)