QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692677 | #5520. Distance Parities | LinkWish | WA | 0ms | 3564kb | C++14 | 1.6kb | 2024-10-31 14:54:01 | 2024-10-31 14:54:22 |
Judging History
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)