Submission #50185

#TimeUsernameProblemLanguageResultExecution timeMemory
50185TalantRail (IOI14_rail)C++17
30 / 100
93 ms896 KiB
#include "rail.h"

#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back

using namespace std;

const int N = (int)2e5 + 5;

int n;
int mn = 1e9,st;

void findLocation(int N, int first, int location[], int stype[])
{
      n = N;

      for (int i = 1; i < n; i ++) {
            int o = getDistance(0,i);
            if (mn > o) mn = o,st = i;
      }
      location[0] = first;
      location[st] = first + mn;

      stype[0] = 1;
      stype[st] = 2;

      for (int i = 1; i < n; i ++) {
            if (location[i])
                  continue;
            int a = getDistance(0,i);
            int b = getDistance(st,i);
            if (a > b) {
                  stype[i] = 1;
                  location[i] = location[st] - b;
            }
            else {
                  stype[i] = 2;
                  location[i] = first + a;
            }
      }

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...