제출 #453439

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4534392021-08-04 11:28:07nonsensenonsense1Palembang Bridges (APIO15_bridge)C++17
22 / 100
257 ms1440 KiB
#include <cstdio>
#include <vector>
const int N = 1000000000;
int k, n;
std::vector<std::pair<int, int> > a;
long long test2(int x, int y)
{
long long s = 0;
for (int i = 0; i < (int)a.size(); ++i) s += std::min(std::max(a[i].first - x, 0) + std::max(x - a[i].second, 0), std::max(a[i].first - y, 0) + std::max(y - a[i].second, 0));
return s;
}
long long test1(int x)
{
int l = x, r = N, opt;
while (l <= r) {
int m = l + r >> 1;
if (test2(x, m) <= test2(x, m + 1)) {
opt = m;
r = m - 1;
}
else l = m + 1;
}
return test2(x, opt);
}
long long test0()
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

bridge.cpp: In function 'long long int test1(int)':
bridge.cpp:20:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |   int m = l + r >> 1;
      |           ~~^~~
bridge.cpp: In function 'long long int test0()':
bridge.cpp:34:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |   int m = l + r >> 1;
      |           ~~^~~
bridge.cpp: In function 'int main()':
bridge.cpp:47:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |  scanf("%d%d", &k, &n);
      |  ~~~~~^~~~~~~~~~~~~~~~
bridge.cpp:51:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   scanf(" %c%d %c%d", &type_from, &from, &type_to, &to);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bridge.cpp: In function 'long long int test1(int)':
bridge.cpp:27:14: warning: 'opt' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |  return test2(x, opt);
      |         ~~~~~^~~~~~~~
bridge.cpp: In function 'long long int test0()':
bridge.cpp:41:14: warning: 'opt' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |  return test1(opt);
      |         ~~~~~^~~~~
#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...