QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#844084#9960. Baggageucup-team6329#WA 1ms5980kbC++231.4kb2025-01-05 14:16:512025-01-05 14:16:51

Judging History

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

  • [2025-01-05 14:16:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5980kb
  • [2025-01-05 14:16:51]
  • 提交

answer

#include <bits/stdc++.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;
using namespace std;
template <class T>
inline void read(T &x){
    int ch = 0, f = 0; x = 0;
    for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = 1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    if(f) x = -x;
}
const int N = 405;
const ll inf = 1e18;
ll f[N][N][3];
int n, m;
inline void up(ll &x, ll y){ x = x > y ? y : x; }
int main(){
    read(n), read(m);
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            for(int p = 0; p < 3; p++) if(i != j) f[i][j][p] = inf;    
    for(int i = 1, a, b, c, d; i <= m; i++){
        read(a), read(b), read(c), read(d);
        for(int p = 0; p <= d; p++) up(f[a][b][p], c);
    }
    for(int p = 0; p <= 2; p++){
        if(p == 2){
            for(int i = 1; i <= n; i++)
                for(int j = 1; j <= n; j++)
                    up(f[i][j][p], f[i][j][1] * 2 + f[j][i][0]);
        }
        for(int k = 1; k <= n; k++)
            for(int i = 1; i <= n; i++)
                for(int j = 1; j <= n; j++)
                    up(f[i][j][p], f[i][k][p] + f[k][j][p]);
    }
    for(int i = 1; i <= n; i++, puts(""))
        for(int j = 1; j <= n; j++) 
            printf("%lld ", f[i][j][2] == inf ? -1 : f[i][j][2]);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

5 7
1 2 500 2
2 3 100 1
3 5 20 2
5 4 5 1
4 2 1 0
3 4 40 2
5 4 77 1

output:

0 500 726 751 746 
-1 0 226 251 246 
-1 -1 0 40 20 
-1 -1 -1 0 -1 
-1 -1 -1 131 0 

result:

ok 25 numbers

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5980kb

input:

30 5000
1 15 15034 0
1 15 15034 0
24 28 14745 2
1 15 15034 0
16 25 13210 0
16 22 26942 0
24 20 5423 1
4 12 636 0
16 12 19327 0
1 15 15034 0
1 15 15034 0
3 28 18940 2
1 15 15034 0
15 9 6468 0
20 3 6233 2
19 4 10829 2
1 15 15034 0
26 6 20998 0
1 15 15034 0
1 15 15034 0
1 15 15034 0
4 14 20515 2
1 15 1...

output:

0 868 1159 2449 3001 1108 1557 3972 596 1521 3923 1332 3230 871 2010 2145 1610 783 2009 1490 2120 3440 2627 4515 228 958 2630 4394 3681 2618 
2534 3402 291 3106 3753 3127 4053 4838 3130 2387 4580 464 4486 1719 2784 2818 2476 3317 2343 777 2777 3121 1759 5381 2762 1354 5164 6928 3603 3370 
2243 3111 ...

result:

wrong answer 32nd numbers differ - expected: '0', found: '3402'