Submission #416090

# Submission time Handle Problem Language Result Execution time Memory
416090 2021-06-02T00:03:25 Z duality Stations (IOI20_stations) C++14
39 / 100
1361 ms 1112 KB
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
#include "stations.h"

vi adjList[1000],L;
int num = 0;
int doDFS(int u,int p,int d) {
    int i;
    if (!d) L[u] = num++;
    for (i = 0; i < adjList[u].size(); i++) {
        int v = adjList[u][i];
        if (v != p) doDFS(v,u,!d);
    }
    if (d) L[u] = num++;
    return 0;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v) {
    int i;
    for (i = 0; i < n-1; i++) adjList[u[i]].pb(v[i]),adjList[v[i]].pb(u[i]);
    L = vi(n),num = 0,doDFS(0,-1,0);
    for (i = 0; i < n; i++) adjList[i].clear();
    return L;
}
int find_next_station(int s,int t,vector<int> c) {
    if (s < c[0]) {
        if ((t < s) || (t > c.back())) return c.back();
        else return *lower_bound(c.begin(),c.end(),t);
    }
    else {
        if ((t < c[0]) || (t > s)) return c[0];
        else return *(--upper_bound(c.begin(),c.end(),t));
    }
}

Compilation message

stations.cpp: In function 'int doDFS(int, int, int)':
stations.cpp:64:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |     for (i = 0; i < adjList[u].size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 693 ms 508 KB Output is correct
2 Correct 576 ms 628 KB Output is correct
3 Correct 933 ms 488 KB Output is correct
4 Correct 772 ms 572 KB Output is correct
5 Correct 845 ms 400 KB Output is correct
6 Correct 742 ms 612 KB Output is correct
7 Correct 541 ms 492 KB Output is correct
8 Correct 6 ms 460 KB Output is correct
9 Correct 4 ms 540 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 487 ms 528 KB Output is correct
2 Correct 638 ms 524 KB Output is correct
3 Correct 959 ms 484 KB Output is correct
4 Correct 750 ms 412 KB Output is correct
5 Correct 707 ms 484 KB Output is correct
6 Correct 416 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 537 ms 692 KB Output is correct
2 Correct 564 ms 640 KB Output is correct
3 Correct 1198 ms 576 KB Output is correct
4 Correct 1020 ms 664 KB Output is correct
5 Correct 771 ms 548 KB Output is correct
6 Correct 515 ms 524 KB Output is correct
7 Correct 469 ms 520 KB Output is correct
8 Correct 4 ms 488 KB Output is correct
9 Correct 5 ms 500 KB Output is correct
10 Correct 2 ms 456 KB Output is correct
11 Correct 667 ms 440 KB Output is correct
12 Correct 620 ms 888 KB Output is correct
13 Correct 669 ms 584 KB Output is correct
14 Correct 535 ms 556 KB Output is correct
15 Correct 55 ms 528 KB Output is correct
16 Correct 66 ms 528 KB Output is correct
17 Correct 144 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1361 ms 500 KB Output is correct
2 Correct 1063 ms 508 KB Output is correct
3 Correct 686 ms 708 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
5 Correct 8 ms 808 KB Output is correct
6 Correct 3 ms 1040 KB Output is correct
7 Correct 711 ms 604 KB Output is correct
8 Correct 953 ms 940 KB Output is correct
9 Correct 909 ms 576 KB Output is correct
10 Correct 738 ms 856 KB Output is correct
11 Correct 5 ms 492 KB Output is correct
12 Correct 10 ms 1112 KB Output is correct
13 Correct 10 ms 448 KB Output is correct
14 Correct 7 ms 420 KB Output is correct
15 Correct 4 ms 680 KB Output is correct
16 Correct 854 ms 536 KB Output is correct
17 Correct 512 ms 400 KB Output is correct
18 Correct 540 ms 408 KB Output is correct
19 Correct 533 ms 460 KB Output is correct
20 Correct 550 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 533 ms 484 KB Output is correct
2 Correct 746 ms 624 KB Output is correct
3 Correct 1220 ms 420 KB Output is correct
4 Correct 1148 ms 492 KB Output is correct
5 Execution timed out 958 ms 400 KB Time limit exceeded (wall clock)
6 Halted 0 ms 0 KB -