답안 #681850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681850 2023-01-14T17:16:50 Z vjudge1 Pipes (BOI13_pipes) C++17
44.0741 / 100
91 ms 17864 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<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll lim = 1e5 + 5;
ll a[lim];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    // (x + y - z) / 2
    ll n, m;
    cin >> n >> m;
    ll tot = 0;
    for(ll i = 1; i <= n; ++i)
        cin >> a[i], tot += a[i];
    pair<pair<ll, ll>, ll> adj[m + 1];
    ll cs[n + 1];
    memset(cs, 0, sizeof(cs));
    vector<ll> res;
    for(ll i = 1; i <= m; ++i) {
        ll 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(ll 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:28: warning: unused variable 'adj' [-Wunused-variable]
   33 |     pair<pair<ll, ll>, ll> adj[m + 1];
      |                            ^~~
# 결과 실행 시간 메모리 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 340 KB Output isn't correct
4 Incorrect 23 ms 5332 KB Output isn't correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Incorrect 0 ms 212 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 20 ms 4604 KB Output isn't correct
14 Incorrect 25 ms 5152 KB Output isn't correct
15 Incorrect 24 ms 5332 KB Output isn't correct
16 Incorrect 28 ms 4704 KB Output isn't correct
17 Incorrect 24 ms 5352 KB Output isn't correct
18 Incorrect 30 ms 5348 KB Output isn't correct
19 Incorrect 23 ms 5332 KB Output isn't correct
20 Incorrect 0 ms 212 KB Output isn't correct
21 Incorrect 0 ms 340 KB Output isn't correct
22 Incorrect 23 ms 5352 KB Output isn't correct
23 Incorrect 18 ms 4564 KB Output isn't correct
24 Incorrect 24 ms 5288 KB Output isn't correct
25 Incorrect 21 ms 4692 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Correct 25 ms 5196 KB Output is correct
4 Correct 32 ms 5360 KB Output is correct
5 Correct 22 ms 5204 KB Output is correct
6 Correct 91 ms 17748 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 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Incorrect 0 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 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Incorrect 1 ms 340 KB Output isn't correct
23 Incorrect 25 ms 4604 KB Output isn't correct
24 Incorrect 23 ms 5356 KB Output isn't correct
25 Correct 23 ms 5076 KB Output is correct
26 Correct 28 ms 5352 KB Output is correct
27 Correct 26 ms 5324 KB Output is correct
28 Correct 24 ms 5460 KB Output is correct
29 Correct 88 ms 15444 KB Output is correct
30 Incorrect 26 ms 5292 KB Output isn't correct
31 Incorrect 33 ms 5332 KB Output isn't correct
32 Incorrect 25 ms 5296 KB Output isn't correct
33 Correct 23 ms 5332 KB Output is correct
34 Correct 24 ms 5332 KB Output is correct
35 Correct 24 ms 5408 KB Output is correct
36 Correct 25 ms 5332 KB Output is correct
37 Correct 91 ms 17864 KB Output is correct
38 Incorrect 24 ms 5276 KB Output isn't correct
39 Incorrect 51 ms 5324 KB Output isn't correct
40 Incorrect 25 ms 5332 KB Output isn't correct
41 Correct 25 ms 5332 KB Output is correct
42 Correct 29 ms 5316 KB Output is correct
43 Correct 29 ms 5380 KB Output is correct
44 Correct 23 ms 5300 KB Output is correct
45 Correct 74 ms 15792 KB Output is correct
46 Incorrect 24 ms 5336 KB Output isn't correct
47 Incorrect 25 ms 5332 KB Output isn't correct
48 Incorrect 23 ms 5300 KB Output isn't correct
49 Correct 22 ms 5160 KB Output is correct
50 Correct 23 ms 5332 KB Output is correct
51 Correct 29 ms 5316 KB Output is correct
52 Correct 23 ms 5332 KB Output is correct
53 Correct 80 ms 16240 KB Output is correct
54 Incorrect 26 ms 5224 KB Output isn't correct