Submission #1345927


Source Code Expand

Copy
#include<bits/stdc++.h>

using namespace std;

int main()
{
  int N, X[1000], Y[1000], C[1000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i] >> C[i];
  }

  auto beet = [&](double x, double y)
  {
    double ret = 0;
    for(int i = 0; i < N; i++) {
      ret = max(ret, max(abs(X[i] - x), abs(Y[i] - y)) * C[i]);
    }
    return (ret);
  };

  auto check = [&](double v)
  {
    double ret = 1e30;
    double low = -1e6, high = 1e6;
    for(int i = 0; i < 200; i++) {
      double l = (low * 2 + high) / 3;
      double r = (low + high * 2) / 3;
      double latte = beet(v, l);
      double malta = beet(v, r);
      ret = min(ret, latte);
      ret = min(ret, malta);
      if(latte < malta) high = r;
      else low = l;
    }
    return (ret);
  };
  double ret = 1e30;
  double low = -1e6, high = 1e6;
  for(int i = 0; i < 200; i++) {
    double l = (low * 2 + high) / 3;
    double r = (low + high * 2) / 3;
    double latte = check(l);
    double malta = check(r);
    ret = min(ret, latte);
    ret = min(ret, malta);
    if(check(l) < check(r)) high = r;
    else low = l;
  }
  cout << fixed << setprecision(10) << ret << endl;
}

Submission Info

Submission Time
Task B - 高橋ノルム君
User ei13333
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1215 Byte
Status
Exec Time 740 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0
Subtask1 30 / 30 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt
Subtask2 70 / 70 subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 5 ms 256 KB
subtask0_sample_02.txt 5 ms 256 KB
subtask0_sample_03.txt 10 ms 256 KB
subtask0_sample_04.txt 8 ms 256 KB
subtask1_01.txt 5 ms 256 KB
subtask1_02.txt 5 ms 256 KB
subtask1_03.txt 5 ms 256 KB
subtask1_04.txt 739 ms 256 KB
subtask1_05.txt 735 ms 256 KB
subtask1_06.txt 734 ms 256 KB
subtask1_07.txt 738 ms 256 KB
subtask1_08.txt 740 ms 256 KB
subtask1_09.txt 736 ms 256 KB
subtask1_10.txt 733 ms 256 KB
subtask1_11.txt 735 ms 256 KB
subtask1_12.txt 734 ms 256 KB
subtask1_13.txt 736 ms 256 KB
subtask2_01.txt 5 ms 256 KB
subtask2_02.txt 5 ms 256 KB
subtask2_03.txt 5 ms 256 KB
subtask2_04.txt 740 ms 256 KB
subtask2_05.txt 739 ms 256 KB
subtask2_06.txt 733 ms 256 KB
subtask2_07.txt 738 ms 256 KB
subtask2_08.txt 739 ms 256 KB
subtask2_09.txt 736 ms 256 KB
subtask2_10.txt 739 ms 256 KB
subtask2_11.txt 733 ms 256 KB
subtask2_12.txt 735 ms 256 KB
subtask2_13.txt 736 ms 256 KB