Submission #1080160

# Submission time Handle Problem Language Result Execution time Memory
1080160 2024-08-29T07:35:29 Z Sir_Ahmed_Imran Stations (IOI20_stations) C++17
0 / 100
2063 ms 2097152 KB
                            ///~~~LOTA~~~///
//#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 1501
int m;
vector<int> l;
vector<int> a[N];
void dfs(int v,int u){
    int r=1e9;
    for(auto& i:a[v]){
        if(i==u) continue;
        dfs(i,v);
        r=min(r,l[i]/1000);
    }
    l[v]=min(r,m)*1000+m;
    m++;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
    for(int i=m=0;i<n-1;i++){
        a[u[i]].append(v[i]);
        a[v[i]].append(u[i]);
    }
    for(int i=0;i<n;i++)
        l.append(0);
    dfs(0,-1);
    return l;
}
int find_next_station(int s,int t,vector<int> c){
    int l,r,p,q,x,y,z;
    l=s/1000;r=s%1000;
    p=t/1000;q=t%1000;
    for(auto& i:c){
        x=i/1000;
        y=i%1000;
        if(x<=l && r<=y) z=i;
        if(l<=x && y<=r && x<=p && q<=y)
            return i;
    }
    return z;
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:42:21: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |     int l,r,p,q,x,y,z;
      |                     ^
# Verdict Execution time Memory Grader output
1 Runtime error 1329 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1298 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Invalid length of array as the response of 'label'. scenario=1, n=2, len=4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2063 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -