제출 #609090

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6090902022-07-27 12:09:56PiejanVDC전선 연결 (IOI17_wiring)C++17
0 / 100
149 ms6956 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
long long min_total_length(vector<int>r, vector<int>b) {
const int n = (int)r.size(), m = (int)b.size();
long long dp[45][45];
for(int i = 0 ; i <= 39 ; i++)
for(int j = 0 ; j <= 39 ; j++)
dp[i][j] = 1e15;
dp[0][0] = 0;
int a = 0, c = 0;
vector<pair<int,int>>v;
bool ok = 1;
int f, cnt = 0;
for(int i = 0 ; i < n+m ; i++) {
if(a == n) {v.push_back({1, b[c++]}); continue;}
if(c == m) {v.push_back({0, r[a++]}); continue;}
if(r[a] < b[c])
v.push_back({0, r[a++]});
else
v.push_back({1, b[c++]});
if(i == 0)
f = v.back().first;
if(ok && v.back().first == f)
cnt++;
else ok = 0;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:34:5: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |     if(f) B = cnt;
      |     ^~
#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...