Submission #52780

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
527802018-06-26 17:49:06KieranHorganWiring (IOI17_wiring)C++17
13 / 100
191 ms21352 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m, ans;
vector<int> fullList;
unordered_map<int, bool> isRed, isBlue;
vector<vector<int>> segments;
vector<vector<int>> prefixR;
vector<vector<int>> prefixL;
int calcWire(int s, int l, int r) {
int res = 0;
res += prefixL[s][l];
res += (segments[s].size()-l) * (segments[s+1][0]-segments[s].back());
res += prefixR[s+1][r];
res += (r+1) * (segments[s+1][0]-segments[s].back());
res -= min((int)segments[s].size()-l, r+1)*(segments[s+1][0]-segments[s].back());
return res;
}
int dp[205][205];
long long min_total_length(vector<signed> r, vector<signed> b) {
n = r.size();
m = b.size();
fullList.resize(n+m);
merge(r.begin(), r.end(), b.begin(), b.end(), fullList.begin());
for(auto x: r)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:46:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int s = 0; s < segments.size(); s++) {
                 ~~^~~~~~~~~~~~~~~~~
wiring.cpp:48:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < segments[s].size(); i++)
                  ~~^~~~~~~~~~~~~~~~~~~~
wiring.cpp:52:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < segments[s].size(); i++)
                  ~~^~~~~~~~~~~~~~~~~~~~
wiring.cpp:59:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int j = segments[1].size()-1; j < segments[1].size(); j++) {
                                    ~~^~~~~~~~~~~~~~~~~~~~
#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...