Submission #171392

#TimeUsernameProblemLanguageResultExecution timeMemory
171392gs18103Rail (IOI14_rail)C++14
30 / 100
84 ms632 KiB
#include "rail.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define em emplace
#define all(v) v.begin(), v.end()
#define report(x, l, s) stype[x] = s, location[x] = l, chk[x] = true

using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int MAX = 5050;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;

int d[4][MAX];
bool chk[MAX], LR[MAX];

void findLocation(int n, int l0, int location[], int stype[]) {
    report(0, l0, 1);
    int mi = INF, i1, i2;
    for(int i = 1; i < n; i++) {
        d[0][i] = getDistance(0, i);
        if(d[0][i] < mi) {
            mi = d[0][i], i1 = i;
        }
    }
    report(i1, l0 + mi, 2);
    int ma = 0;
    for(int i = 1; i < n; i++) {
        if(chk[i]) continue;
        d[1][i] = getDistance(i1, i);
        if(d[0][i] == d[0][i1] + d[1][i]) {
            report(i, location[i1] - d[1][i], 1);
        }
        else {
            report(i, location[0] + d[0][i], 2);
        }
    }
}

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:24:23: warning: unused variable 'i2' [-Wunused-variable]
     int mi = INF, i1, i2;
                       ^~
rail.cpp:32:9: warning: unused variable 'ma' [-Wunused-variable]
     int ma = 0;
         ^~
rail.cpp:8:32: warning: 'i1' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define report(x, l, s) stype[x] = s, location[x] = l, chk[x] = true
                                ^
rail.cpp:24:19: note: 'i1' was declared here
     int mi = INF, i1, i2;
                   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...