MSBOP 2015 Round2B register

Ended

Participants:6187

Verdict:AC | WA
Submitted:2015-04-26 14:36:25

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int cas, T, n, m, q;
int s[110];
int d[110][110];
int t0[110], t1[110];
int main()
{
    scanf("%d", &T);
    while(T--){
        scanf("%d%d%d", &n, &m, &q);
        for (int i = 1; i <= n; i++){
            scanf("%d", s+i);
            t0[i] = t1[i] = 0;
        }
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++) d[i][j] = 0;
        int x, y, z, ans = 0;
        for (int i = 0; i < m; i++){
            scanf("%d%d%d", &x, &y, &z);
            if (s[x] == s[y]){
                t0[x] += z;
                t0[y] += z;
            }
            else{
                t1[x] += z;
                t1[y] += z;
                ans += z;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX