# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
283329 | | rqi | 철로 (IOI14_rail) | C++14 | | 89 ms | 632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
#define mp make_pair
#define f first
#define s second
const int MOD = 1000000007;
const int mx = 5005;
int pos1[mx];
int pos2[mx];
void findLocation(int N, int first, int location[], int stype[])
{
stype[0] = 1;
location[0] = first;
pi mn = mp(MOD, -1);
for(int i = 1; i < N; i++){
pos1[i] = getDistance(0, i);
mn = min(mn, mp(pos1[i], i));
}
stype[mn.s] = 2;
location[mn.s] = first+mn.f;
for(int i = 1; i < N; i++){
if(i == mn.s) continue;
pos2[i] = getDistance(mn.s, i);
}
for(int i = 1; i < N; i++){
if(i == mn.s) continue;
if(pos1[i] > pos2[i]){
stype[i] = 1;
location[i] = first-(pos1[i]-2*mn.f);
}
else{
stype[i] = 2;
location[i] = first+pos1[i];
}
}
// stype[0] = 1;
// location[0] = first;
// for(int i = 1; i < N; i++){
// stype[i] = 2;
// location[i] = location[0]+getDistance(0, i);
// }
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |