Submission #1155110

#TimeUsernameProblemLanguageResultExecution timeMemory
1155110andrewpTraffic (IOI10_traffic)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>  
#include "traffic.h"
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())     
const int N=1e6+10;  

ll n, ps[N], ss[N];
ll pss[N], sss[N]; 

int LocateCentre(int N_,int P[],int S[],int D[]) {
    n=N_;
    bool p50=true;
    for (int i=0; i<n; i++) 
        p50&=(s[i]==i&&d[i]==i+1);
    if (p50) { 
        for (int i=1; i<=n; i++) {
            ps[i]=ps[i-1]+P[i-1];
            pss[i]=pss[i-1]+ps[i];  
        }
        for (int i=n; i>=1; i--) { 
            ss[i]=ss[i+1]+P[i-1]; 
            sss[i]=sss[i+1]+ss[i];  
        }
        ll ans=(ll)(1e18);
        int ret=0;
        for (int i=1; i<=n; i++) {
            if (ans>pss[i-1]+sss[i+1]) {
                ans=pss[i-1]+sss[i+1];
                ret=i;
            }   
        }
        return (ret-1);
    } 
    
}

int main () {    
    ios::sync_with_stdio(false), cin.tie(0); 
            

    return 0;
}          

Compilation message (stderr)

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:19:15: error: 's' was not declared in this scope
   19 |         p50&=(s[i]==i&&d[i]==i+1);
      |               ^
traffic.cpp:19:24: error: 'd' was not declared in this scope
   19 |         p50&=(s[i]==i&&d[i]==i+1);
      |                        ^
traffic.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^