제출 #1014189

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10141892024-07-04 13:50:52aykhn전선 연결 (IOI17_wiring)C++17
17 / 100
1099 ms10184 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
long long min_total_length(vector<int> r, vector<int> b)
{
vector<array<long long, 2>> a;
int i = 0, j = 0;
while (i < r.size() && j < b.size())
{
if (r[i] <= b[j]) a.push_back({r[i++], 0});
else a.push_back({b[j++], 1});
}
while (i < r.size()) a.push_back({r[i++], 0});
while (j < b.size()) a.push_back({b[j++], 1});
vector<long long> dp(a.size(), 1e18);
vector<long long> mn(a.size(), 1e18);
long long rl = -1e18, bl = -1e18;
for (int i = 0; i < a.size(); i++)
{
if (a[i][1] == 0) mn[i] = min(mn[i], abs(a[i][0] - bl)), rl = a[i][0];
else mn[i] = min(mn[i], abs(a[i][0] - rl)), bl = a[i][0];
}
rl = 1e18, bl = 1e18;
for (int i = (int)a.size() - 1; i >= 0; i--)
{
if (a[i][1] == 0) mn[i] = min(mn[i], abs(a[i][0] - bl)), rl = a[i][0];
else mn[i] = min(mn[i], abs(a[i][0] - rl)), bl = a[i][0];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  while (i < r.size() && j < b.size())
      |         ~~^~~~~~~~~~
wiring.cpp:10:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  while (i < r.size() && j < b.size())
      |                         ~~^~~~~~~~~~
wiring.cpp:15:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  while (i < r.size()) a.push_back({r[i++], 0});
      |         ~~^~~~~~~~~~
wiring.cpp:16:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  while (j < b.size()) a.push_back({b[j++], 1});
      |         ~~^~~~~~~~~~
wiring.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for (int i = 0; i < a.size(); i++)
      |                  ~~^~~~~~~~~~
wiring.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for (int i = 0; i < a.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...