Submission details
Task:3SUM
Sender:hundlij1
Submission time:2025-10-20 16:36:38 +0300
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.01 sdetails
#10--details
#11--details
#12--details
#13--details
#14--details
#15--details
#16--details
#17--details
#18--details
#19--details
#20--details
#21--details
#22--details
#230.00 sdetails

Compiler report

input/code.cpp: In function 'll maxflow(ll, ll)':
input/code.cpp:42:21: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   42 |     while (new_flow = bfs(s, t, parent)) {
      |            ~~~~~~~~~^~~~~~~~~~~~~~~~~~~

Code

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <climits>
using namespace std;
typedef long long ll;
ll n;
vector<vector<ll>> capacity;
vector<vector<ll>> adj;

ll bfs(ll s, ll t, vector<ll>& parent) {
    fill(parent.begin(), parent.end(), -1);
    parent[s] = -2;
    queue<pair<ll, ll>> q;
    q.push({s, LLONG_MAX});
    
    while (!q.empty()) {
        ll cur = q.front().first;
        ll flow = q.front().second;
        q.pop();
        
        for (ll next : adj[cur]) {
            if (parent[next] == -1 && capacity[cur][next]) {
                parent[next] = cur;
                ll new_flow = min(flow, capacity[cur][next]);
                if (next == t) return new_flow;
                q.push({next, new_flow});
            }
        }
    }
    
    return 0;
}

ll maxflow(ll s, ll t) {
    ll flow = 0;
    vector<ll> parent(n + 1);
    ll new_flow;
    
    while (new_flow = bfs(s, t, parent)) {
        flow += new_flow;
        ll cur = t;
        while (cur != s) {
            ll prev = parent[cur];
            capacity[prev][cur] -= new_flow;
            capacity[cur][prev] += new_flow;
            cur = prev;
        }
    }
    
    return flow;
}

void task1(){
    ll s, t;
    cin >> s >> t;
    vector<ll> ints(n + 1);
    for(ll i = 1; i <= s; i++) cin >> ints[i];

    for(int i = 1; i <= s; i++){
        for(int j = i; j <= s; j++){
            for(int k = j; k <= s; k++){
                if(ints[i] + ints[j] + ints[k] == t){
                    cout << i << " " << j << " " << k << endl;
                    return;
                }
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
}

void task2(){
     ll m;
    cin >> n >> m;
    capacity.assign(n + 1, vector<ll>(n + 1, 0));
    adj.assign(n + 1, vector<ll>());
    
    for (ll i = 0; i < m; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        capacity[a][b] += c;
        adj[a].push_back(b);
    }
}


int main() {
   task1();
}

Test details

Test 1

Verdict:

input
1 3
1

correct output
IMPOSSIBLE

user output
1 1 1

Test 2

Verdict:

input
3 5
1 3 2

correct output
IMPOSSIBLE

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 3

Verdict:

input
3 6
1 3 2

correct output
1 3 2

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 4

Verdict:

input
3 7
3 2 1

correct output
IMPOSSIBLE

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 5

Verdict:

input
7 3
2 1 1 2 2 1 1

correct output
2 3 7

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 6

Verdict:

input
7 4
1 1 2 2 1 2 1

correct output
1 2 6

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 7

Verdict:

input
7 5
1 2 1 2 2 1 1

correct output
1 2 5

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 8

Verdict:

input
7 6
2 1 1 1 1 2 2

correct output
1 6 7

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 9

Verdict:

input
5000 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1 2 5000

user output
(empty)

Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Test 10

Verdict:

input
5000 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
IMPOSSIBLE

user output
(empty)

Test 11

Verdict:

input
5000 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
714 3518 4240

user output
(empty)

Test 12

Verdict:

input
5000 919900245
663612758 9075403 585385629 98...

correct output
2787 465 2266

user output
(empty)

Test 13

Verdict:

input
5000 999989608
12983 25966 38949 51932 64915 ...

correct output
IMPOSSIBLE

user output
(empty)

Test 14

Verdict:

input
5000 1000000000
65536 131072 196608 262144 327...

correct output
IMPOSSIBLE

user output
(empty)

Test 15

Verdict:

input
5000 642700000
6427 12854 19281 25708 32135 3...

correct output
IMPOSSIBLE

user output
(empty)

Test 16

Verdict:

input
5000 919900246
663612758 9075403 585385629 98...

correct output
193 1698 4019

user output
(empty)

Test 17

Verdict:

input
5000 919900247
663612758 9075403 585385629 98...

correct output
4258 470 1911

user output
(empty)

Test 18

Verdict:

input
5000 6
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

correct output
4998 4999 5000

user output
(empty)

Test 19

Verdict:

input
5000 919900247
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
IMPOSSIBLE

user output
(empty)

Test 20

Verdict:

input
4999 919900245
9075403 585385629 987230075 83...

correct output
2786 464 2265

user output
(empty)

Test 21

Verdict:

input
5000 1000000000
261323261 25262018 237798562 3...

correct output
IMPOSSIBLE

user output
(empty)

Test 22

Verdict:

input
5000 76305003
1 5088 10175 15262 20349 25436...

correct output
IMPOSSIBLE

user output
(empty)

Test 23

Verdict:

input
2 6
2 2

correct output
IMPOSSIBLE

user output
1 1 1