CSES - Leirikisa 4 - Results
Submission details
Task:Graph
Sender:vgtcross
Submission time:2023-04-20 17:09:17 +0300
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED5
#2ACCEPTED12
#3ACCEPTED17
#4ACCEPTED24
#5ACCEPTED42
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2, 3, 4, 5details
#2ACCEPTED0.01 s1, 2, 3, 4, 5details
#3ACCEPTED0.01 s1, 2, 3, 4, 5details
#4ACCEPTED0.01 s1, 2, 3, 4, 5details
#5ACCEPTED0.01 s1, 2, 3, 4, 5details
#6ACCEPTED0.01 s1, 2, 3, 4, 5details
#7ACCEPTED0.01 s1, 2, 3, 4, 5details
#8ACCEPTED0.01 s1, 2, 3, 4, 5details
#9ACCEPTED0.01 s1, 2, 3, 4, 5details
#10ACCEPTED0.01 s1, 2, 3, 4, 5details
#11ACCEPTED0.01 s1, 2, 3, 4, 5details
#12ACCEPTED0.01 s1, 2, 3, 4, 5details
#13ACCEPTED0.01 s1, 2, 3, 4, 5details
#14ACCEPTED0.01 s1, 2, 3, 4, 5details
#15ACCEPTED0.01 s1, 2, 3, 4, 5details
#16ACCEPTED0.01 s1, 2, 3, 4, 5details
#17ACCEPTED0.01 s1, 2, 3, 4, 5details
#18ACCEPTED0.01 s1, 2, 3, 4, 5details
#19ACCEPTED0.01 s1, 2, 3, 4, 5details
#20ACCEPTED0.01 s1, 2, 3, 4, 5details
#21ACCEPTED0.01 s1, 2, 3, 4, 5details
#22ACCEPTED0.01 s1, 2, 3, 4, 5details
#23ACCEPTED0.01 s1, 2, 3, 4, 5details
#24ACCEPTED0.01 s2, 3, 4, 5details
#25ACCEPTED0.01 s2, 3, 4, 5details
#26ACCEPTED0.01 s2, 3, 4, 5details
#27ACCEPTED0.01 s2, 3, 4, 5details
#28ACCEPTED0.01 s2, 3, 4, 5details
#29ACCEPTED0.01 s2, 3, 4, 5details
#30ACCEPTED0.01 s2, 3, 4, 5details
#31ACCEPTED0.01 s2, 3, 4, 5details
#32ACCEPTED0.01 s2, 3, 4, 5details
#33ACCEPTED0.01 s2, 3, 4, 5details
#34ACCEPTED0.01 s2, 3, 4, 5details
#35ACCEPTED0.01 s2, 3, 4, 5details
#36ACCEPTED0.01 s2, 3, 4, 5details
#37ACCEPTED0.01 s3, 4, 5details
#38ACCEPTED0.01 s3, 4, 5details
#39ACCEPTED0.01 s3, 4, 5details
#40ACCEPTED0.01 s3, 4, 5details
#41ACCEPTED0.01 s3, 4, 5details
#42ACCEPTED0.01 s3, 4, 5details
#43ACCEPTED0.01 s3, 4, 5details
#44ACCEPTED0.01 s3, 4, 5details
#45ACCEPTED0.01 s3, 4, 5details
#46ACCEPTED0.01 s3, 4, 5details
#47ACCEPTED0.01 s3, 4, 5details
#48ACCEPTED0.01 s3, 4, 5details
#49ACCEPTED0.01 s4, 5details
#50ACCEPTED0.02 s4, 5details
#51ACCEPTED0.02 s4, 5details
#52ACCEPTED0.01 s4, 5details
#53ACCEPTED0.01 s4, 5details
#54ACCEPTED0.01 s4, 5details
#55ACCEPTED0.01 s4, 5details
#56ACCEPTED0.01 s4, 5details
#57ACCEPTED0.01 s4, 5details
#58ACCEPTED0.01 s4, 5details
#59ACCEPTED0.01 s4, 5details
#60ACCEPTED0.01 s4, 5details
#61ACCEPTED0.01 s4, 5details
#62ACCEPTED0.07 s4, 5details
#63ACCEPTED0.07 s4, 5details
#64ACCEPTED0.07 s4, 5details
#65ACCEPTED0.07 s4, 5details
#66ACCEPTED0.01 s4, 5details
#67ACCEPTED0.11 s5details
#68ACCEPTED0.10 s5details
#69ACCEPTED0.09 s5details
#70ACCEPTED0.13 s5details
#71ACCEPTED0.10 s5details
#72ACCEPTED0.12 s5details
#73ACCEPTED0.11 s5details
#74ACCEPTED0.08 s5details
#75ACCEPTED0.03 s5details
#76ACCEPTED0.02 s5details
#77ACCEPTED0.03 s5details
#78ACCEPTED0.05 s5details
#79ACCEPTED0.10 s5details
#80ACCEPTED0.09 s5details
#81ACCEPTED0.06 s5details
#82ACCEPTED0.13 s5details
#83ACCEPTED0.17 s5details
#84ACCEPTED0.17 s5details
#85ACCEPTED0.11 s5details
#86ACCEPTED0.11 s5details
#87ACCEPTED0.07 s5details
#88ACCEPTED0.16 s5details
#89ACCEPTED0.10 s5details
#90ACCEPTED0.12 s5details
#91ACCEPTED0.11 s5details
#92ACCEPTED0.06 s5details
#93ACCEPTED0.05 s5details
#94ACCEPTED0.07 s5details
#95ACCEPTED0.05 s5details
#96ACCEPTED0.19 s5details
#97ACCEPTED0.05 s5details

Compiler report

input/code.cpp: In function 'int dfs(int)':
input/code.cpp:41:21: warning: unused variable 'col2' [-Wunused-variable]
   41 |                 int col2 = 3 - col[u];
      |                     ^~~~

Code

#include <bits/stdc++.h>

#define debug(x) cout << #x << ": " << x << endl

#define all(x) x.begin(), x.end()
#define fi first
#define se second

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int N = 100100;

vector<pii> adj[N];
int col[N];
int val[N];
pii x;
vector<int> vals;

void reset(int u) {
    col[u] = -1;
    for (pii v: adj[u]) if (col[v.fi] >= 0) {
        reset(v.fi);
    }
}

int dfs(int u) {
    vals.push_back(val[u] * (2*col[u]-3));
    for (pii v: adj[u]) {
        if (!col[v.fi]) {
            col[v.fi] = 3 - col[u];
            val[v.fi] = 2*v.se - val[u];
            int res = dfs(v.fi);
            if (res != 1) return res;
        } else {
            if (col[v.fi] != col[u] && val[v.fi] != 2*v.se - val[u]) {
                return -1;
            } else if (col[v.fi] == col[u]) {
                int val2 = 2*v.se - val[u];
                int col2 = 3 - col[u];
                x.fi = -val[v.fi];
                x.fi += val2;
                x.fi /= 2;
                x.fi += val[v.fi];
                x.se = v.fi;
                return 0;
            }
        }
    }
    
    return 1;
}

bool dfs2(int u) {
    for (pii v: adj[u]) {
        if (col[v.fi] == -1) {
            col[v.fi] = 1;
            val[v.fi] = 2*v.se - val[u];
            int bad = dfs2(v.fi);
            if (bad) return 1;
        } else {
            if (val[v.fi] != 2*v.se - val[u]) {
                return 1;
            }
        }
    }
    
    return 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    
    for (int i = 0; i < m; ++i) {
        int u, v, c;
        cin >> u >> v >> c;
        u--;v--;
        adj[u].push_back({v, c});
        adj[v].push_back({u, c});
    }
    
    for (int i = 0; i < n; ++i) if (col[i] == 0) {
        col[i] = 1;
        val[i] = 0;
        vals.clear();
        int res = dfs(i);
        if (res == -1) {
            cout << "NO\n";
            return;
        } else if (res == 0) {
            reset(i);
            col[x.se] = 1;
            val[x.se] = x.fi;
            bool bad = dfs2(x.se);
            if (bad) {
                cout << "NO\n";
                return;
            }
        } else {
            reset(i);
            sort(all(vals));
            col[i] = 1;
            val[i] = vals[vals.size()/2];
            dfs2(i);
        }
    }
    
    cout << "YES\n";
    for (int i = 0; i < n; ++i) {
        cout << (long double)val[i] / 2.0 << ' ';
    }
    cout << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cout << fixed << setprecision(9);
    
    solve();
    
    return 0;
}

Test details

Test 1

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 4
1 2 1
2 3 2
1 3 2
3 4 1

correct output
YES
0.5 0.5 1.5 -0.5

user output
YES
0.500000000 0.500000000 1.5000...

Test 2

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
2 1
1 2 1

correct output
YES
1 0

user output
YES
1.000000000 0.000000000 

Test 3

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 2
1 2 2
2 3 2

correct output
YES
0 2 0

user output
YES
0.000000000 2.000000000 0.0000...

Test 4

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 4
1 2 2
2 2 1
2 1 1
1 2 2

correct output
NO

user output
NO

Test 5

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
5 2
1 2 1
5 3 2

correct output
YES
1 0 2 0 0

user output
YES
1.000000000 0.000000000 2.0000...

Test 6

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 2
2 1 2
3 2 1

correct output
YES
1 1 0

user output
YES
1.000000000 1.000000000 0.0000...

Test 7

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 3
1 2 1
1 3 1
3 2 1

correct output
YES
0.5 0.5 0.5

user output
YES
0.500000000 0.500000000 0.5000...

Test 8

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 4
1 4 2
3 2 1
2 1 2
3 4 1

correct output
YES
2 0 1 0

user output
YES
2.000000000 0.000000000 1.0000...

Test 9

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 4
1 4 2
1 2 1
3 4 1
3 2 1

correct output
NO

user output
NO

Test 10

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 5
1 4 2
3 2 1
2 1 2
3 4 1
...

correct output
YES
1.5 0.5 0.5 0.5

user output
YES
1.500000000 0.500000000 0.5000...

Test 11

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 5
1 4 2
3 2 1
1 2 2
4 3 1
...

correct output
YES
1.5 0.5 0.5 0.5

user output
YES
1.500000000 0.500000000 0.5000...

Test 12

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
4 4
4 2 2
4 3 1
1 3 2
1 2 1

correct output
NO

user output
NO

Test 13

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
5 14
2 1 1
3 2 1
4 3 1
1 4 1
...

correct output
YES
0.5 0.5 0.5 0.5 1.5

user output
YES
0.500000000 0.500000000 0.5000...

Test 14

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
5 4
2 5 1
5 4 2
4 1 2
1 3 1

correct output
YES
1 0 0 1 1

user output
YES
1.000000000 0.000000000 0.0000...

Test 15

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
5 4
2 4 1
5 4 2
4 1 2
4 3 1

correct output
YES
1 0 0 1 1

user output
YES
1.000000000 0.000000000 0.0000...

Test 16

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
5 5
3 5 2
2 4 1
5 4 2
4 1 2
...

correct output
YES
1.5 0.5 0.5 0.5 1.5

user output
YES
1.500000000 0.500000000 0.5000...

Test 17

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
1 0

correct output
YES
0

user output
YES
0.000000000 

Test 18

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
1 1
1 1 1

correct output
YES
0.5

user output
YES
0.500000000 

Test 19

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 14
1 1 2
1 1 2
2 2 1
2 3 2
...

correct output
YES
1 0.5 1.5

user output
YES
1.000000000 0.500000000 1.5000...

Test 20

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 4
2 2 1
1 2 2
1 3 2
3 3 1

correct output
YES
1.5 0.5 0.5

user output
YES
1.500000000 0.500000000 0.5000...

Test 21

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
2 2
1 2 2
2 1 2

correct output
YES
2 0

user output
YES
2.000000000 0.000000000 

Test 22

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
2 2
1 2 2
2 1 1

correct output
NO

user output
NO

Test 23

Group: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 14
1 1 2
1 1 2
2 2 1
2 3 1
...

correct output
NO

user output
NO

Test 24

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 99
10 91 1
10 86 2
86 81 2
10 62 1
...

correct output
YES
0 2 1 1 2 0 1 0 0 1 -1 -1 1 1 ...

user output
YES
0.000000000 2.000000000 1.0000...
Truncated

Test 25

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
50 49
31 8 2
31 7 2
31 34 1
7 49 1
...

correct output
YES
2 1 -1 2 -1 2 1 1 2 1 1 2 -1 0...

user output
YES
2.000000000 1.000000000 -1.000...
Truncated

Test 26

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
88 87
16 28 1
28 32 2
32 34 1
32 3 2
...

correct output
YES
3 1 1 -2 1 1 1 0 2 2 0 2 0 0 1...

user output
YES
3.000000000 1.000000000 1.0000...
Truncated

Test 27

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
88 88
16 28 1
28 32 2
32 34 1
32 3 2
...

correct output
YES
2 2 0 -3 0 2 2 1 3 3 -1 3 -1 1...

user output
YES
2.000000000 2.000000000 0.0000...
Truncated

Test 28

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 100
17 44 1
30 17 2
18 30 1
88 18 2
...

correct output
YES
2 0 0 2 0 0 2 1 1 3 0 2 -1 2 3...

user output
YES
2.000000000 0.000000000 0.0000...
Truncated

Test 29

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 100
17 57 1
30 17 1
18 30 1
88 18 1
...

correct output
YES
3 1 0 2 1 1 2 0 0 2 1 2 0 1 2 ...

user output
YES
3.000000000 1.000000000 0.0000...
Truncated

Test 30

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 100
17 57 1
30 17 2
18 30 1
88 18 2
...

correct output
NO

user output
NO

Test 31

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
77 77
33 31 2
68 66 1
10 8 2
24 22 2
...

correct output
YES
1.5 2 0.5 0 1.5 1 -0.5 1 2.5 1...

user output
YES
1.500000000 2.000000000 0.5000...
Truncated

Test 32

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
77 77
77 77 1
76 76 1
75 75 1
74 2 2
...

correct output
YES
0.5 0.5 1 1.5 1 1 0.5 0.5 1.5 ...

user output
YES
0.500000000 0.500000000 1.0000...
Truncated

Test 33

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
76 38
2 1 1
65 4 1
67 6 2
66 8 1
...

correct output
YES
1 0 2 1 1 2 2 1 1 1 0 2 2 2 2 ...

user output
YES
1.000000000 0.000000000 2.0000...
Truncated

Test 34

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
100 113
82 73 1
65 22 1
58 24 1
4 52 1
...

correct output
YES
0.5 0.5 0.5 0.5 0.5 0.5 0.5 0....

user output
YES
0.500000000 0.500000000 0.5000...
Truncated

Test 35

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
77 77
33 31 2
68 66 1
10 8 2
24 22 1
...

correct output
YES
0.5 1 1.5 1 0.5 1 0.5 0 0.5 2 ...

user output
YES
0.500000000 1.000000000 1.5000...
Truncated

Test 36

Group: 2, 3, 4, 5

Verdict: ACCEPTED

input
77 78
33 31 2
68 66 1
10 8 2
24 22 1
...

correct output
YES
1 0.5 1 1.5 1 0.5 0 0.5 1 1.5 ...

user output
YES
1.000000000 0.500000000 1.0000...
Truncated

Test 37

Group: 3, 4, 5

Verdict: ACCEPTED

input
211 210
129 163 1
129 193 1
129 65 1
163 142 2
...

correct output
YES
0 0 -1 1 -1 1 1 1 1 1 1 0 1 2 ...

user output
YES
0.000000000 0.000000000 -1.000...
Truncated

Test 38

Group: 3, 4, 5

Verdict: ACCEPTED

input
211 211
129 163 1
129 193 1
129 65 1
163 142 2
...

correct output
YES
-0.5 0.5 -0.5 0.5 -0.5 1.5 0.5...

user output
YES
-0.500000000 0.500000000 -0.50...
Truncated

Test 39

Group: 3, 4, 5

Verdict: ACCEPTED

input
547 546
15 139 2
139 397 1
15 327 1
15 510 1
...

correct output
YES
1 0 -1 2 1 1 1 0 2 0 1 1 2 1 1...

user output
YES
1.000000000 0.000000000 -1.000...
Truncated

Test 40

Group: 3, 4, 5

Verdict: ACCEPTED

input
935 935
923 195 1
388 923 1
439 388 2
101 439 1
...

correct output
YES
6 3 -1 -1 3 -2 -1 -4 1 2 -6 -6...

user output
YES
6.000000000 3.000000000 -1.000...
Truncated

Test 41

Group: 3, 4, 5

Verdict: ACCEPTED

input
935 935
621 758 2
758 394 1
24 758 1
543 24 1
...

correct output
NO

user output
NO

Test 42

Group: 3, 4, 5

Verdict: ACCEPTED

input
935 935
923 195 1
388 923 1
439 388 2
101 439 1
...

correct output
YES
4 1 -4 3 6 -3 4 9 0 -2 -2 4 -3...

user output
YES
4.000000000 1.000000000 -4.000...
Truncated

Test 43

Group: 3, 4, 5

Verdict: ACCEPTED

input
999 996
10 58 2
101 80 2
101 812 1
106 178 1
...

correct output
YES
1 2 1 1 2 2 -2 1 1 3 0 2 1 -1 ...

user output
YES
1.000000000 2.000000000 1.0000...
Truncated

Test 44

Group: 3, 4, 5

Verdict: ACCEPTED

input
994 987
769 256 2
906 812 1
453 603 1
556 451 2
...

correct output
YES
2 2 -4 3 -1 -4 0 -1 0 -1 -2 -1...

user output
YES
2.000000000 2.000000000 -4.000...
Truncated

Test 45

Group: 3, 4, 5

Verdict: ACCEPTED

input
994 994
769 256 2
906 812 1
453 603 1
556 451 2
...

correct output
YES
3.5 4.5 -3.5 0.5 -3 -6.5 -11 -...

user output
YES
3.500000000 4.500000000 -3.500...
Truncated

Test 46

Group: 3, 4, 5

Verdict: ACCEPTED

input
500 491
87 78 2
78 434 1
434 26 1
26 98 1
...

correct output
YES
2 0 0 1 0 -1 0 1 0 0 0 0 0 1 2...

user output
YES
2.000000000 0.000000000 0.0000...
Truncated

Test 47

Group: 3, 4, 5

Verdict: ACCEPTED

input
994 994
769 256 2
906 812 1
453 603 1
556 451 2
...

correct output
YES
1.5 4.5 -3.5 0.5 -2.5 -6.5 -7....

user output
YES
1.500000000 4.500000000 -3.500...
Truncated

Test 48

Group: 3, 4, 5

Verdict: ACCEPTED

input
994 994
769 256 2
906 812 1
453 603 1
556 451 2
...

correct output
YES
-3.5 -0.5 -8.5 5.5 2.5 -1.5 -2...

user output
YES
-3.500000000 -0.500000000 -8.5...
Truncated

Test 49

Group: 4, 5

Verdict: ACCEPTED

input
10000 9999
5747 266 1
266 9872 1
5747 8144 1
9872 2774 2
...

correct output
YES
0 -1 1 0 1 1 3 0 2 3 3 3 -3 3 ...

user output
YES
0.000000000 -1.000000000 1.000...
Truncated

Test 50

Group: 4, 5

Verdict: ACCEPTED

input
9973 9973
1477 3608 1
8395 1477 2
5665 8395 1
2668 5665 2
...

correct output
YES
8.5 22.5 -7.5 24.5 0.5 -8.5 -6...

user output
YES
8.500000000 22.500000000 -7.50...
Truncated

Test 51

Group: 4, 5

Verdict: ACCEPTED

input
9973 9973
8395 1477 2
5665 8395 1
2668 5665 2
7601 2668 2
...

correct output
YES
5 7 1 9 8 9 16 1 16 -8 -13 -5 ...

user output
YES
5.000000000 7.000000000 1.0000...
Truncated

Test 52

Group: 4, 5

Verdict: ACCEPTED

input
9973 9973
3608 4715 2
4715 2860 1
803 3645 1
3645 1477 2
...

correct output
NO

user output
NO

Test 53

Group: 4, 5

Verdict: ACCEPTED

input
1023 1022
872 171 1
171 588 2
588 510 2
171 189 1
...

correct output
YES
0 2 1 0 2 0 1 2 -1 2 1 0 -1 3 ...

user output
YES
0.000000000 2.000000000 1.0000...
Truncated

Test 54

Group: 4, 5

Verdict: ACCEPTED

input
2371 2370
1991 1896 1
1991 655 2
1991 722 1
655 130 2
...

correct output
YES
5 0 1 3 -1 1 4 0 1 0 2 4 3 0 -...

user output
YES
5.000000000 0.000000000 1.0000...
Truncated

Test 55

Group: 4, 5

Verdict: ACCEPTED

input
4997 4996
4963 352 2
4963 1455 2
1455 2819 1
4963 4962 2
...

correct output
YES
2 2 2 2 0 2 1 1 -1 0 1 2 1 0 -...

user output
YES
2.000000000 2.000000000 2.0000...
Truncated

Test 56

Group: 4, 5

Verdict: ACCEPTED

input
9778 9777
4271 8223 1
8223 7058 1
8223 7079 1
4271 3842 1
...

correct output
YES
-1 1 -1 1 1 2 3 0 1 1 -1 1 -1 ...

user output
YES
-1.000000000 1.000000000 -1.00...
Truncated

Test 57

Group: 4, 5

Verdict: ACCEPTED

input
9997 9225
5985 4701 2
4701 2238 2
2238 8981 2
4701 639 1
...

correct output
YES
3 2 0 1 0 2 0 1 3 2 -1 0 -1 1 ...

user output
YES
3.000000000 2.000000000 0.0000...
Truncated

Test 58

Group: 4, 5

Verdict: ACCEPTED

input
9000 8997
23 909 1
909 297 2
297 125 2
125 856 2
...

correct output
YES
2 1 2 0 0 1 2 0 -1 1 2 -1 1 -1...

user output
YES
2.000000000 1.000000000 2.0000...
Truncated

Test 59

Group: 4, 5

Verdict: ACCEPTED

input
9000 9000
23 909 1
909 297 2
297 125 2
125 856 2
...

correct output
YES
3 2 3 1 1 2 3 1 0 0 1 -2 2 -2 ...

user output
YES
3.000000000 2.000000000 3.0000...
Truncated

Test 60

Group: 4, 5

Verdict: ACCEPTED

input
10000 9993
5747 266 1
266 9872 1
5747 8144 1
9872 2774 2
...

correct output
YES
1 -2 0 1 0 1 2 -1 2 2 3 2 -4 3...

user output
YES
1.000000000 -2.000000000 0.000...
Truncated

Test 61

Group: 4, 5

Verdict: ACCEPTED

input
5000 5000
1537 2983 1
2983 1590 2
1590 1547 1
1547 4457 1
...

correct output
YES
3 0 -3 5 0 4 0 -1 3 -1 5 2 2 0...

user output
YES
3.000000000 0.000000000 -3.000...
Truncated

Test 62

Group: 4, 5

Verdict: ACCEPTED

input
7779 200000
5647 4480 1
3952 7125 2
4078 2641 1
4841 2183 1
...

correct output
NO

user output
NO

Test 63

Group: 4, 5

Verdict: ACCEPTED

input
7779 200000
5647 4480 2
3952 7125 2
4078 2641 2
4841 2183 2
...

correct output
YES
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
YES
1.000000000 1.000000000 1.0000...
Truncated

Test 64

Group: 4, 5

Verdict: ACCEPTED

input
7783 200000
5647 4480 2
3952 7125 2
4078 2641 2
4841 2183 2
...

correct output
NO

user output
NO

Test 65

Group: 4, 5

Verdict: ACCEPTED

input
7783 200000
5647 4480 2
3952 7125 2
4078 2641 2
4841 2183 2
...

correct output
YES
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

user output
YES
1.000000000 1.000000000 1.0000...
Truncated

Test 66

Group: 4, 5

Verdict: ACCEPTED

input
2000 1998
1673 1643 1
1643 1877 1
1643 1622 2
1643 1533 1
...

correct output
YES
2 1 1 2 1 2 0 -1 0 -1 1 -1 0 2...

user output
YES
2.000000000 1.000000000 1.0000...
Truncated

Test 67

Group: 5

Verdict: ACCEPTED

input
100000 99999
1 2 2
2 3 1
3 4 2
4 5 2
...

correct output
YES
-27 29 -28 30 -28 29 -27 29 -2...

user output
YES
-27.000000000 29.000000000 -28...
Truncated

Test 68

Group: 5

Verdict: ACCEPTED

input
100000 99999
1 2 1
2 3 1
3 4 1
4 5 1
...

correct output
YES
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ...

user output
YES
1.000000000 0.000000000 1.0000...
Truncated

Test 69

Group: 5

Verdict: ACCEPTED

input
99999 99999
1 2 1
2 3 1
3 4 2
4 5 1
...

correct output
YES
1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 ...

user output
YES
1.000000000 0.000000000 1.0000...
Truncated

Test 70

Group: 5

Verdict: ACCEPTED

input
100000 200000
1 2 1
2 3 1
3 4 1
4 5 1
...

correct output
YES
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ...

user output
YES
1.000000000 0.000000000 1.0000...
Truncated

Test 71

Group: 5

Verdict: ACCEPTED

input
99999 99999
1 2 2
2 3 1
3 4 2
4 5 1
...

correct output
YES
1.5 0.5 0.5 1.5 -0.5 1.5 0.5 0...

user output
YES
1.500000000 0.500000000 0.5000...
Truncated

Test 72

Group: 5

Verdict: ACCEPTED

input
100000 99999
46010 73517 1
46010 71237 1
73517 84882 1
46010 88029 2
...

correct output
YES
-4 0 -1 1 -1 -3 1 1 0 0 0 1 2 ...

user output
YES
-4.000000000 0.000000000 -1.00...
Truncated

Test 73

Group: 5

Verdict: ACCEPTED

input
100000 100000
99997 99996 2
46010 73517 1
46010 71237 1
73517 84882 1
...

correct output
YES
-4 0 -1 1 -1 -3 1 1 0 0 0 1 2 ...

user output
YES
-4.000000000 0.000000000 -1.00...
Truncated

Test 74

Group: 5

Verdict: ACCEPTED

input
65432 65432
53092 42562 2
61422 3056 1
22311 61422 1
48701 22311 1
...

correct output
YES
-43 2 -40 73 83 -68 42 -32 -74...

user output
YES
-43.000000000 2.000000000 -40....
Truncated

Test 75

Group: 5

Verdict: ACCEPTED

input
65432 65432
53092 211 1
27132 53092 2
42562 27132 1
211 42562 2
...

correct output
NO

user output
NO

Test 76

Group: 5

Verdict: ACCEPTED

input
12003 12002
9377 4878 2
9377 3429 1
9377 7810 2
7810 5657 1
...

correct output
YES
-2 0 2 -1 0 0 0 -1 0 3 2 1 0 -...

user output
YES
-2.000000000 0.000000000 2.000...
Truncated

Test 77

Group: 5

Verdict: ACCEPTED

input
24578 24577
23603 4344 2
4344 19532 1
23603 3246 1
3246 1886 2
...

correct output
YES
4 2 4 2 -1 0 -2 0 0 0 0 2 -2 1...

user output
YES
4.000000000 2.000000000 4.0000...
Truncated

Test 78

Group: 5

Verdict: ACCEPTED

input
42875 42874
20761 12008 1
20761 1944 1
1944 39972 2
1944 22755 1
...

correct output
YES
-1 2 2 -1 0 2 3 1 3 1 -1 -1 0 ...

user output
YES
-1.000000000 2.000000000 2.000...
Truncated

Test 79

Group: 5

Verdict: ACCEPTED

input
85112 85111
46719 28242 2
46719 12064 1
46719 41742 2
12064 12832 1
...

correct output
YES
3 0 1 0 2 0 2 0 3 1 2 0 1 2 3 ...

user output
YES
3.000000000 0.000000000 1.0000...
Truncated

Test 80

Group: 5

Verdict: ACCEPTED

input
65432 65432
53092 211 1
27132 53092 1
42562 27132 2
17771 211 2
...

correct output
YES
-5 24 -91 23 -7 2 38 16 -11 -1...

user output
YES
-5.000000000 24.000000000 -91....
Truncated

Test 81

Group: 5

Verdict: ACCEPTED

input
100000 100002
56529 57156 2
57156 27549 1
27549 28230 1
28230 7926 1
...

correct output
NO

user output
NO

Test 82

Group: 5

Verdict: ACCEPTED

input
100000 100002
56529 57156 1
57156 27549 2
27549 28230 1
28230 7926 1
...

correct output
YES
23.5 74.5 -28.5 18.5 35.5 17.5...

user output
YES
23.500000000 74.500000000 -28....
Truncated

Test 83

Group: 5

Verdict: ACCEPTED

input
99999 99999
80080 1 1
87783 2 2
61570 3 1
63587 4 1
...

correct output
YES
-11 120 -66 -119 82 -99 -112 -...

user output
YES
-11.000000000 120.000000000 -6...
Truncated

Test 84

Group: 5

Verdict: ACCEPTED

input
100000 100000
80080 1 1
87783 2 2
61570 3 1
63587 4 1
...

correct output
YES
82 27 27 -26 -11 -6 -19 -24 -1...

user output
YES
82.000000000 27.000000000 27.0...
Truncated

Test 85

Group: 5

Verdict: ACCEPTED

input
100000 100000
1 2 2
2 3 1
3 4 2
4 5 2
...

correct output
YES
5 -3 4 -2 4 -3 5 -3 4 -2 3 -2 ...

user output
YES
5.000000000 -3.000000000 4.000...
Truncated

Test 86

Group: 5

Verdict: ACCEPTED

input
99999 99999
1 2 2
2 3 1
3 4 2
4 5 2
...

correct output
YES
-8 10 -9 11 -9 10 -8 10 -9 11 ...

user output
YES
-8.000000000 10.000000000 -9.0...
Truncated

Test 87

Group: 5

Verdict: ACCEPTED

input
100000 100000
56529 22247 1
57156 76873 2
27549 74689 2
28230 20136 2
...

correct output
NO

user output
NO

Test 88

Group: 5

Verdict: ACCEPTED

input
100000 99993
56529 22247 1
57156 76873 2
27549 74689 2
28230 20136 2
...

correct output
YES
63.5 -37.5 -3 -50.5 -28.5 49.5...

user output
YES
63.500000000 -37.500000000 -3....
Truncated

Test 89

Group: 5

Verdict: ACCEPTED

input
99995 99995
78058 31441 1
31441 51023 1
51023 74459 1
74459 23055 2
...

correct output
YES
1.5 0.5 0.5 1 0.5 0.5 1 1.5 -0...

user output
YES
1.500000000 0.500000000 0.5000...
Truncated

Test 90

Group: 5

Verdict: ACCEPTED

input
99995 99993
78058 31441 1
31441 51023 1
51023 74459 1
23055 78058 1
...

correct output
YES
1 0 1 0.5 1 0.5 0.5 1 0.5 0.5 ...

user output
YES
1.000000000 0.000000000 1.0000...
Truncated

Test 91

Group: 5

Verdict: ACCEPTED

input
99995 99991
1 20142 2
2 6002 2
3 82095 1
4 60745 2
...

correct output
YES
0.5 1 1.5 1 0 1.5 0.5 1 1 0.5 ...

user output
YES
0.500000000 1.000000000 1.5000...
Truncated

Test 92

Group: 5

Verdict: ACCEPTED

input
50000 50000
24269 39765 1
24269 22722 2
24269 43371 2
24269 38058 2
...

correct output
YES
-2.5 -0.5 0.5 0.5 2.5 0.5 0.5 ...

user output
YES
-2.500000000 -0.500000000 0.50...
Truncated

Test 93

Group: 5

Verdict: ACCEPTED

input
50000 50000
12607 45763 2
45763 7230 1
7230 4820 2
12607 46801 2
...

correct output
YES
1 1 1 2 4 0 2 0 -1 3 3 1 -1 1 ...

user output
YES
1.000000000 1.000000000 1.0000...
Truncated

Test 94

Group: 5

Verdict: ACCEPTED

input
100000 100000
80080 1 1
87783 2 2
61570 3 1
63587 4 1
...

correct output
NO

user output
NO

Test 95

Group: 5

Verdict: ACCEPTED

input
99995 99993
1 20142 2
2 6002 2
3 82095 1
4 60745 2
...

correct output
NO

user output
NO

Test 96

Group: 5

Verdict: ACCEPTED

input
99997 200000
13425 90048 1
81741 46019 1
35193 33756 1
4840 2182 1
...

correct output
YES
0.5 0.5 0.5 0.5 0.5 0.5 0.5 0....

user output
YES
0.500000000 0.500000000 0.5000...
Truncated

Test 97

Group: 5

Verdict: ACCEPTED

input
100000 100000
1 2 2
2 3 1
3 4 2
4 5 2
...

correct output
NO

user output
NO