Submission #681849

# Submission time Handle Problem Language Result Execution time Memory
681849 2023-01-14T17:08:43 Z vjudge1 Pipes (BOI13_pipes) C++17
44.0741 / 100
103 ms 19556 KB
// header file
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// pragma
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// macros
#define endl "\n"
#define ll long long
#define mp make_pair
#define ins insert
#define lb lower_bound
#define pb push_back
#define ub upper_bound
#define lll __int128
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int lim = 1e5 + 5;
int a[lim];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    // (x + y - z) / 2
    int n, m;
    cin >> n >> m;
    ll tot = 0;
    for(int i = 1; i <= n; ++i)
        cin >> a[i], tot += a[i];
    pair<pair<int, int>, ll> adj[m + 1];
    ll cs[n + 1];
    memset(cs, 0, sizeof(cs));
    vector<ll> res;
    for(int i = 1; i <= m; ++i) {
        int x, y;
        cin >> x >> y;    
        ll tmp = (2 * (a[x] + a[y]) - tot) / 2;
        res.pb(tmp);
        cs[x] += tmp;
        cs[y] += tmp;
    }
    bool ans = 1;
    for(int i = 1; i <= n; ++i)
        ans &= (cs[i] == a[i]);
    if(ans) {
        for(auto i : res)
            cout << 2 * i << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:33:30: warning: unused variable 'adj' [-Wunused-variable]
   33 |     pair<pair<int, int>, ll> adj[m + 1];
      |                              ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Incorrect 29 ms 5560 KB Output isn't correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Incorrect 1 ms 340 KB Output isn't correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Incorrect 1 ms 340 KB Output isn't correct
10 Incorrect 1 ms 340 KB Output isn't correct
11 Incorrect 1 ms 340 KB Output isn't correct
12 Incorrect 1 ms 340 KB Output isn't correct
13 Incorrect 22 ms 4880 KB Output isn't correct
14 Incorrect 24 ms 5492 KB Output isn't correct
15 Incorrect 31 ms 5580 KB Output isn't correct
16 Incorrect 21 ms 4968 KB Output isn't correct
17 Incorrect 25 ms 5552 KB Output isn't correct
18 Incorrect 26 ms 5540 KB Output isn't correct
19 Incorrect 23 ms 5592 KB Output isn't correct
20 Incorrect 0 ms 332 KB Output isn't correct
21 Incorrect 1 ms 340 KB Output isn't correct
22 Incorrect 26 ms 5504 KB Output isn't correct
23 Incorrect 19 ms 4776 KB Output isn't correct
24 Incorrect 25 ms 5568 KB Output isn't correct
25 Incorrect 19 ms 5032 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Correct 24 ms 5348 KB Output is correct
4 Correct 24 ms 5508 KB Output is correct
5 Correct 24 ms 5520 KB Output is correct
6 Correct 89 ms 19556 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Incorrect 1 ms 212 KB Output isn't correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Incorrect 1 ms 340 KB Output isn't correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 468 KB Output is correct
22 Incorrect 1 ms 340 KB Output isn't correct
23 Incorrect 19 ms 4948 KB Output isn't correct
24 Incorrect 31 ms 5580 KB Output isn't correct
25 Correct 29 ms 5452 KB Output is correct
26 Correct 27 ms 5580 KB Output is correct
27 Correct 30 ms 5580 KB Output is correct
28 Correct 25 ms 5684 KB Output is correct
29 Correct 75 ms 16048 KB Output is correct
30 Incorrect 24 ms 5572 KB Output isn't correct
31 Incorrect 24 ms 5504 KB Output isn't correct
32 Incorrect 23 ms 5576 KB Output isn't correct
33 Correct 25 ms 5576 KB Output is correct
34 Correct 26 ms 5584 KB Output is correct
35 Correct 30 ms 5584 KB Output is correct
36 Correct 24 ms 5580 KB Output is correct
37 Correct 103 ms 19484 KB Output is correct
38 Incorrect 25 ms 5524 KB Output isn't correct
39 Incorrect 25 ms 5564 KB Output isn't correct
40 Incorrect 23 ms 5556 KB Output isn't correct
41 Correct 25 ms 5588 KB Output is correct
42 Correct 24 ms 5600 KB Output is correct
43 Correct 24 ms 5528 KB Output is correct
44 Correct 23 ms 5508 KB Output is correct
45 Correct 77 ms 16732 KB Output is correct
46 Incorrect 24 ms 5584 KB Output isn't correct
47 Incorrect 26 ms 5500 KB Output isn't correct
48 Incorrect 32 ms 5524 KB Output isn't correct
49 Correct 27 ms 5408 KB Output is correct
50 Correct 23 ms 5528 KB Output is correct
51 Correct 25 ms 5580 KB Output is correct
52 Correct 27 ms 5452 KB Output is correct
53 Correct 88 ms 17316 KB Output is correct
54 Incorrect 24 ms 5496 KB Output isn't correct