| Task: | 3SUM |
| Sender: | hundlij1 |
| Submission time: | 2025-10-20 16:36:38 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | RUNTIME ERROR | 0.00 s | details |
| #3 | RUNTIME ERROR | 0.00 s | details |
| #4 | RUNTIME ERROR | 0.00 s | details |
| #5 | RUNTIME ERROR | 0.00 s | details |
| #6 | RUNTIME ERROR | 0.00 s | details |
| #7 | RUNTIME ERROR | 0.00 s | details |
| #8 | RUNTIME ERROR | 0.00 s | details |
| #9 | RUNTIME ERROR | 0.01 s | details |
| #10 | TIME LIMIT EXCEEDED | -- | details |
| #11 | TIME LIMIT EXCEEDED | -- | details |
| #12 | TIME LIMIT EXCEEDED | -- | details |
| #13 | TIME LIMIT EXCEEDED | -- | details |
| #14 | TIME LIMIT EXCEEDED | -- | details |
| #15 | TIME LIMIT EXCEEDED | -- | details |
| #16 | TIME LIMIT EXCEEDED | -- | details |
| #17 | TIME LIMIT EXCEEDED | -- | details |
| #18 | TIME LIMIT EXCEEDED | -- | details |
| #19 | TIME LIMIT EXCEEDED | -- | details |
| #20 | TIME LIMIT EXCEEDED | -- | details |
| #21 | TIME LIMIT EXCEEDED | -- | details |
| #22 | TIME LIMIT EXCEEDED | -- | details |
| #23 | WRONG ANSWER | 0.00 s | details |
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: WRONG ANSWER
| input |
|---|
| 1 3 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 1 1 1 |
Test 2
Verdict: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: RUNTIME ERROR
| 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: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 919900245 663612758 9075403 585385629 98... |
| correct output |
|---|
| 2787 465 2266 |
| user output |
|---|
| (empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 999989608 12983 25966 38949 51932 64915 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 1000000000 65536 131072 196608 262144 327... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 642700000 6427 12854 19281 25708 32135 3... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 919900246 663612758 9075403 585385629 98... |
| correct output |
|---|
| 193 1698 4019 |
| user output |
|---|
| (empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 919900247 663612758 9075403 585385629 98... |
| correct output |
|---|
| 4258 470 1911 |
| user output |
|---|
| (empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| input |
|---|
| 4999 919900245 9075403 585385629 987230075 83... |
| correct output |
|---|
| 2786 464 2265 |
| user output |
|---|
| (empty) |
Test 21
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 1000000000 261323261 25262018 237798562 3... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 22
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 5000 76305003 1 5088 10175 15262 20349 25436... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 23
Verdict: WRONG ANSWER
| input |
|---|
| 2 6 2 2 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 1 1 1 |
