Submission #1080166

# Submission time Handle Problem Language Result Execution time Memory
1080166 2024-08-29T07:37:42 Z Sir_Ahmed_Imran Stations (IOI20_stations) C++17
52.3244 / 100
657 ms 1272 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 1000
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){
    l.clear();
    for(int i=0;i<n;i++){
        a[i].clear();
        l.append(0);
    }
    for(int i=m=0;i<n-1;i++){
        a[u[i]].append(v[i]);
        a[v[i]].append(u[i]);
    }
    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:45:21: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |     int l,r,p,q,x,y,z;
      |                     ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1004
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=511994
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 363 ms 684 KB Output is correct
2 Correct 302 ms 712 KB Output is correct
3 Correct 586 ms 688 KB Output is correct
4 Correct 477 ms 684 KB Output is correct
5 Correct 391 ms 684 KB Output is correct
6 Correct 299 ms 684 KB Output is correct
7 Correct 233 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 2 ms 776 KB Output is correct
10 Correct 0 ms 796 KB Output is correct
11 Correct 417 ms 684 KB Output is correct
12 Correct 320 ms 932 KB Output is correct
13 Correct 337 ms 932 KB Output is correct
14 Correct 333 ms 684 KB Output is correct
15 Correct 28 ms 764 KB Output is correct
16 Correct 56 ms 984 KB Output is correct
17 Correct 82 ms 684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 613 ms 684 KB Output is correct
2 Correct 431 ms 684 KB Output is correct
3 Correct 353 ms 684 KB Output is correct
4 Correct 2 ms 1272 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Correct 341 ms 684 KB Output is correct
8 Correct 657 ms 684 KB Output is correct
9 Correct 466 ms 684 KB Output is correct
10 Correct 410 ms 684 KB Output is correct
11 Correct 3 ms 764 KB Output is correct
12 Correct 4 ms 764 KB Output is correct
13 Correct 3 ms 768 KB Output is correct
14 Correct 1 ms 776 KB Output is correct
15 Correct 1 ms 1100 KB Output is correct
16 Correct 371 ms 684 KB Output is correct
17 Correct 353 ms 684 KB Output is correct
18 Correct 339 ms 684 KB Output is correct
19 Correct 336 ms 684 KB Output is correct
20 Correct 371 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 393 ms 712 KB Partially correct
2 Partially correct 339 ms 684 KB Partially correct
3 Correct 586 ms 684 KB Output is correct
4 Partially correct 444 ms 684 KB Partially correct
5 Partially correct 368 ms 684 KB Partially correct
6 Partially correct 358 ms 684 KB Partially correct
7 Partially correct 332 ms 680 KB Partially correct
8 Partially correct 1 ms 768 KB Partially correct
9 Correct 3 ms 768 KB Output is correct
10 Partially correct 1 ms 768 KB Partially correct
11 Partially correct 319 ms 688 KB Partially correct
12 Partially correct 369 ms 684 KB Partially correct
13 Correct 601 ms 680 KB Output is correct
14 Partially correct 427 ms 684 KB Partially correct
15 Partially correct 399 ms 940 KB Partially correct
16 Partially correct 298 ms 1188 KB Partially correct
17 Partially correct 341 ms 684 KB Partially correct
18 Partially correct 328 ms 684 KB Partially correct
19 Partially correct 303 ms 780 KB Partially correct
20 Partially correct 305 ms 684 KB Partially correct
21 Partially correct 31 ms 768 KB Partially correct
22 Partially correct 56 ms 764 KB Partially correct
23 Partially correct 59 ms 964 KB Partially correct
24 Partially correct 3 ms 764 KB Partially correct
25 Partially correct 3 ms 764 KB Partially correct
26 Partially correct 2 ms 768 KB Partially correct
27 Partially correct 2 ms 768 KB Partially correct
28 Partially correct 0 ms 768 KB Partially correct
29 Partially correct 360 ms 684 KB Partially correct
30 Partially correct 392 ms 684 KB Partially correct
31 Partially correct 373 ms 684 KB Partially correct
32 Partially correct 377 ms 684 KB Partially correct
33 Partially correct 375 ms 684 KB Partially correct
34 Partially correct 230 ms 684 KB Partially correct
35 Partially correct 252 ms 796 KB Partially correct
36 Partially correct 308 ms 788 KB Partially correct
37 Partially correct 287 ms 804 KB Partially correct
38 Partially correct 296 ms 804 KB Partially correct
39 Partially correct 298 ms 796 KB Partially correct
40 Partially correct 274 ms 932 KB Partially correct
41 Partially correct 309 ms 788 KB Partially correct
42 Partially correct 45 ms 716 KB Partially correct
43 Partially correct 64 ms 760 KB Partially correct
44 Partially correct 80 ms 684 KB Partially correct
45 Partially correct 107 ms 684 KB Partially correct
46 Partially correct 202 ms 684 KB Partially correct
47 Partially correct 206 ms 684 KB Partially correct
48 Partially correct 35 ms 736 KB Partially correct
49 Partially correct 28 ms 764 KB Partially correct