Submission #1068406

#TimeUsernameProblemLanguageResultExecution timeMemory
1068406edogawa_somethingWiring (IOI17_wiring)C++17
7 / 100
19 ms7048 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pii; typedef vector<ll> vii; #define F first #define S second #define all(v) v.begin(),v.end() #define pb push_back ll ans,dp[300][300]; long long min_total_length(std::vector<int> r, std::vector<int> b) { for(int i=0;i<=r.size();i++) for(int j=0;j<=b.size();j++) dp[i][j]=ll(1e18); dp[1][1]=abs(b[0]-r[0]); for(int i=1;i<=r.size();i++) { for(int j=1;j<=b.size();j++) { if(i>1) { dp[i][j]=min(dp[i][j],dp[i-1][j]+abs(r[i-1]-b[j-1])); } if(j>1) { dp[i][j]=min(dp[i][j],dp[i][j-1]+abs(r[i-1]-b[j-1])); } if(i>1&&j>1) { dp[i][j]=min(dp[i][j],dp[i-1][j-1]+abs(r[i-1]-b[j-1])); } } } return dp[r.size()][b.size()]; }

Compilation message (stderr)

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