Submission #589975

# Submission time Handle Problem Language Result Execution time Memory
589975 2022-07-05T12:43:16 Z AlesL0 Wiring (IOI17_wiring) C++17
13 / 100
34 ms 3768 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = 1e9+1;

long long min_total_length(std::vector<int> r, std::vector<int> b){
    ll s = 0;
    int mr = 0, mb = INF;
    for (int i = 0; i < b.size(); i++){
        s += b[i]; mb = min(mb, b[i]);
    }
    for (int i = 0; i < r.size(); i++){
        s -= r[i]; mr = max(mr, r[i]);
    }
    ll n = r.size(), m = b.size();
    if (n > m)s += (n-m)*mb;
    else s -= (m-n)*mr;
    return s;
}

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: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int i = 0; i < b.size(); i++){
      |                     ~~^~~~~~~~~~
wiring.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i = 0; i < r.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 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 17 ms 2892 KB Output is correct
4 Correct 17 ms 2932 KB Output is correct
5 Correct 16 ms 2900 KB Output is correct
6 Correct 22 ms 3664 KB Output is correct
7 Correct 34 ms 3768 KB Output is correct
8 Correct 26 ms 3764 KB Output is correct
9 Correct 24 ms 3756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 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 304 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 -