Submission #377700

#TimeUsernameProblemLanguageResultExecution timeMemory
377700AlexRex0Traffic (IOI10_traffic)C++14
50 / 100
363 ms20076 KiB
#include "traffic.h"
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
long long int a[1000002];
static int N,P[1000000],S[1000000],D[1000000];
int LocateCentre(int N, int pp[], int S[], int D[]) {
    int res = 0;
    long long int menor = 2000000000000001;
    a[0] = 0;
    a[N + 1] = 0;
    for(int i = 1; i <= N; ++i){
        a[i] = pp[i - 1] + a[i - 1];
    }
    for(int i = 2; i < N; ++i){
        long long int aux = a[N] - a[i];
        long long int aux2 = a[i - 1];
        aux = max(aux, aux2);
        if(aux < menor){
            menor = aux;
            res = i;
        }
    }
    long long int aux = 0;
    aux = a[N] - a[1];
    if(aux < menor){
        menor = aux;
        res = 1;
    }
    aux = a[N - 1];
    if(aux < menor){
        menor = aux;
        res = N;
    }
    res--;
    return res;
}

Compilation message (stderr)

traffic.cpp:6:36: warning: 'D' defined but not used [-Wunused-variable]
    6 | static int N,P[1000000],S[1000000],D[1000000];
      |                                    ^
traffic.cpp:6:25: warning: 'S' defined but not used [-Wunused-variable]
    6 | static int N,P[1000000],S[1000000],D[1000000];
      |                         ^
traffic.cpp:6:14: warning: 'P' defined but not used [-Wunused-variable]
    6 | static int N,P[1000000],S[1000000],D[1000000];
      |              ^
traffic.cpp:6:12: warning: 'N' defined but not used [-Wunused-variable]
    6 | static int N,P[1000000],S[1000000],D[1000000];
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...