Submission #1056379

# Submission time Handle Problem Language Result Execution time Memory
1056379 2024-08-13T09:05:21 Z Ignut Longest Trip (IOI23_longesttrip) C++17
15 / 100
753 ms 592 KB
/* Ignut
started: 13.08.2024
now: 13.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████    ████████████████████████████████
██████████████████████████████        ██████████████████████████████
██████      ██████████████████        ██████████████████      ██████
██████          ██████████████        ██████████████          ██████
██████      ██    ████████████        ████████████    ██      ██████
██████      ████    ██████████        ██████████    ████      ██████
██████      ████      ██████████    ██████████      ████      ██████
██████      ████      ██████████    ██████████    ██████      ██████
██████      ██████    ██████████    ██████████    ██████      ██████
██████      ██████    ████████        ████████    ██████      ██████
██████      ██████      ██████        ██████      ██████      ██████
██████      ████        ████            ████        ████      ██████
██████            ██████████    ████    ██████████            ██████
██████      ██      ██████    ████████    ██████      ██      ██████
██████      ██████            ████████            ██████      ██████
██████                    ██            ██                    ██████
██████████████████████      ████    ████      ██████████████████████
████████████████████████      ██    ██      ████████████████████████
██████████████████████████                ██████████████████████████
██████████████████████████████        ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

bool are_connected(vector<int> A, vector<int> B);

vector<int> longest_trip(int N, int D) {
    if (D == 3) {
        vector<int> vec;
        for (int i = 0; i < N; i ++) vec.push_back(i);
        return vec;
    }
    vector<pair<int, int>> lst;
    int cnt[N] = {};
    for (int i = 0; i < N; i ++) {
        for (int j = i + 1; j < N; j ++) {
            if (!are_connected({i}, {j})) {
                lst.push_back({i, j});
                cnt[i] ++, cnt[j] ++;
            }
        }
    }
    vector<int> free;
    for (int i = 0; i < N; i ++) if (cnt[i] == 0) free.push_back(i);

    vector<int> res;
    for (int i = 0; i < lst.size(); i ++) res.push_back(lst[i].first);
    for (int val : free) res.push_back(val);
    for (int i = 0; i < lst.size(); i ++) res.push_back(lst[i].second);
    return res;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for (int i = 0; i < lst.size(); i ++) res.push_back(lst[i].first);
      |                     ~~^~~~~~~~~~~~
longesttrip.cpp:57:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for (int i = 0; i < lst.size(); i ++) res.push_back(lst[i].second);
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 14 ms 344 KB Output is correct
3 Correct 112 ms 344 KB Output is correct
4 Correct 314 ms 344 KB Output is correct
5 Correct 753 ms 412 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 20 ms 344 KB Output is correct
8 Correct 115 ms 344 KB Output is correct
9 Correct 248 ms 344 KB Output is correct
10 Correct 699 ms 592 KB Output is correct
11 Correct 709 ms 592 KB Output is correct
12 Correct 704 ms 592 KB Output is correct
13 Correct 724 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Correct 122 ms 344 KB Output is correct
4 Correct 316 ms 344 KB Output is correct
5 Correct 733 ms 412 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 22 ms 340 KB Output is correct
8 Correct 110 ms 344 KB Output is correct
9 Correct 274 ms 356 KB Output is correct
10 Correct 688 ms 344 KB Output is correct
11 Correct 668 ms 592 KB Output is correct
12 Correct 683 ms 344 KB Output is correct
13 Correct 716 ms 408 KB Output is correct
14 Incorrect 0 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 18 ms 344 KB Output is correct
3 Partially correct 128 ms 344 KB Output is partially correct
4 Partially correct 335 ms 344 KB Output is partially correct
5 Partially correct 636 ms 412 KB Output is partially correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 21 ms 344 KB Output is correct
8 Partially correct 120 ms 344 KB Output is partially correct
9 Partially correct 274 ms 344 KB Output is partially correct
10 Partially correct 684 ms 344 KB Output is partially correct
11 Partially correct 685 ms 408 KB Output is partially correct
12 Partially correct 699 ms 412 KB Output is partially correct
13 Partially correct 715 ms 416 KB Output is partially correct
14 Incorrect 1 ms 340 KB Incorrect
15 Halted 0 ms 0 KB -