Submission #617484

# Submission time Handle Problem Language Result Execution time Memory
617484 2022-08-01T11:42:07 Z Sergio_2357 Wiring (IOI17_wiring) C++17
13 / 100
23 ms 3772 KB
#include "wiring.h"
#include <bits/stdc++.h>

using namespace std;

#define int long long

int min_total_length(vector<signed> r, vector<signed> b)
{
    sort(b.begin(), b.end());
    int res = 0;
    for (int i = 0; i < r.size(); i++)
        res += b[0] - r[i];
    if (r.size() < b.size())
        res += (b[0] - r[r.size() - 1]) * (b.size() - r.size());
    for (int i = 0; i < b.size(); i++)
        res += b[i] - b[0];
    return res;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:12:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int i = 0; i < r.size(); i++)
      |                     ~~^~~~~~~~~~
wiring.cpp:16:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i = 0; i < b.size(); i++)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 22 ms 1408 KB Output is correct
4 Correct 17 ms 1408 KB Output is correct
5 Correct 18 ms 1364 KB Output is correct
6 Correct 23 ms 3772 KB Output is correct
7 Correct 23 ms 3764 KB Output is correct
8 Correct 22 ms 3772 KB Output is correct
9 Correct 23 ms 3752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '17703', found: '-19052'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '27', found: '12'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -