QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#305625#7995. 图TenshiWA 8ms3940kbC++20913b2024-01-15 18:37:242024-01-15 18:37:25

Judging History

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

  • [2024-01-15 18:37:25]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3940kb
  • [2024-01-15 18:37:24]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}

const int N=505;

int n;
int g[N][N];
int f[N][N];

signed main(){
	cin>>n;
	rep(i, 1, n) rep(j, 1, n) cin>>g[i][j], f[i][j]=g[i][j];
	rep(k, 1, n) rep(i, 1, n) rep(j, 1, n) f[i][j]=min(f[i][j], f[i][k]+f[k][j]);
	rep(i, 1, n){
		rep(j, 1, n){
			if(i==j) cout<<"0";
			else cout<<(f[i][j]==g[i][j]);
		}
		puts("");
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3620kb

input:

4
0 3 2 100
3 0 8 100
2 8 0 10
100 100 10 0

output:

0110
1000
1001
0010

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

4
0 3 2 100
3 0 8 100
2 8 0 10
100 100 10 0

output:

0110
1000
1001
0010

result:

ok 4 lines

Test #3:

score: -100
Wrong Answer
time: 8ms
memory: 3940kb

input:

100
0 41659 61282 49636 67326 48035 29694 46438 87384 82143 38685 66540 48746 29800 91786 54931 56232 61941 53423 75707 45135 69244 53802 89998 64199 63778 75825 31745 66975 44537 35793 55663 72647 60768 80884 46657 54066 84568 6266 48213 78216 50369 66761 54861 67607 38509 52250 54210 71135 56840 5...

output:

0001000000000000000000000000000000000010010100000000100001001100101000000001000000000000000000010010
0011000000100000000001000000100000000000000000000000000000100000000001001000000001000000010000000100
01001000011000000000000000001000000000000000000000001000001011000010010010000000010000000100000001...

result:

wrong answer 1st lines differ - expected: '000000000000000000000000000000...0000001000000000000000000000010', found: '000100000000000000000000000000...0000001000000000000000000010010'