Submission #800118

#TimeUsernameProblemLanguageResultExecution timeMemory
800118AndreyWiring (IOI17_wiring)C++14
13 / 100
22 ms3764 KiB
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;

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

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:8:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         for(int i = 0; i < b.size(); i++) {
      |                        ~~^~~~~~~~~~
wiring.cpp:11:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         for(int i = 0; i < r.size()-b.size(); i++) {
      |                        ~~^~~~~~~~~~~~~~~~~~~
wiring.cpp:16:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i = 0; i < r.size(); i++) {
      |                        ~~^~~~~~~~~~
wiring.cpp:19:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         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...