Submission #583888

#TimeUsernameProblemLanguageResultExecution timeMemory
583888PiejanVDC전선 연결 (IOI17_wiring)C++17
13 / 100
30 ms3264 KiB
#include <bits/stdc++.h>
#include "wiring.h"

using namespace std;

long long min_total_length(vector<int>r, vector<int>b) {
    long long ans = 0;

    for(int i = 0 ; i < min(b.size(),r.size()) ; i++) {
        ans += min(b[i] - r[r.size()-1] + b[0] - r[r.size() - 1 - i], b[i] - r[r.size() - 1 - i]);
    }

    if(b.size() > r.size()) {
        for(int i = r.size() ; i < b.size() ; i++)
            ans += b[i] - r[r.size()-1];
    } else {
        for(int i = r.size() - 1 - b.size() ; i >= 0 ; i--)
            ans += b[0] - r[i];
    }

    return ans;
}

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
    9 |     for(int i = 0 ; i < min(b.size(),r.size()) ; i++) {
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~
wiring.cpp:14:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int i = r.size() ; i < b.size() ; i++)
      |                                ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...