Submission #232670

# Submission time Handle Problem Language Result Execution time Memory
232670 2020-05-17T19:26:40 Z duality Stray Cat (JOI20_stray) C++14
15 / 100
69 ms 17248 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 "Anthony.h"

vpii adjList[20000];
int dist[20000];
queue<int> Q;
vi m;
string s = "010011";
int doDFS(int u,int p,int c) {
    int i;
    int x = 0;
    for (i = 0; i < adjList[u].size(); i++) {
        int v = adjList[u][i].first;
        if (v != p) x++;
    }
    if (x == 1) {
        for (i = 0; i < adjList[u].size(); i++) {
            int v = adjList[u][i].first;
            if (v != p) m[adjList[u][i].second] = (s[c]-'0'),doDFS(v,u,(c+1) % 6);
        }
    }
    else {
        for (i = 0; i < adjList[u].size(); i++) {
            int v = adjList[u][i].first;
            if (v != p) m[adjList[u][i].second] = (s[c]-'0'),doDFS(v,u,(s[c]-'0')^1);
        }
    }
    return 0;
}
vector<int> Mark(int N,int M,int A,int B,vector<int> U,vector<int> V) {
    if (A >= 3) {
        int i;
        for (i = 0; i < M; i++) {
            adjList[U[i]].pb(mp(V[i],i));
            adjList[V[i]].pb(mp(U[i],i));
        }
        for (i = 0; i < N; i++) dist[i] = -1;
        Q.push(0),dist[0] = 0;
        while (!Q.empty()) {
            int u = Q.front();
            Q.pop();

            for (i = 0; i < adjList[u].size(); i++) {
                int v = adjList[u][i].first;
                if (dist[v] == -1) {
                    dist[v] = dist[u]+1;
                    Q.push(v);
                }
            }
        }
        for (i = 0; i < M; i++) {
            if (dist[U[i]] == dist[V[i]]) m.pb(dist[U[i]] % 3);
            else m.pb(min(dist[U[i]],dist[V[i]]) % 3);
        }
    }
    else {
        m.resize(M);
        doDFS(0,-1,0);
    }

    return m;
}
#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 "Catherine.h"

int a,b;
string s2 = "010011";
void Init(int A,int B) {
    a = A,b = B;
}
int Move(vector<int> y) {
    if (a >= 3) {
        if ((y[1] == 0) && (y[2] == 0)) return 0;
        else if ((y[0] == 0) && (y[2] == 0)) return 1;
        else if ((y[0] == 0) && (y[1] == 0)) return 2;
        else if (y[0] == 0) return 1;
        else if (y[1] == 0) return 2;
        else return 0;
    }
    else {

    }
}

Compilation message

Anthony.cpp: In function 'int doDFS(int, int, int)':
Anthony.cpp:67:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < adjList[u].size(); i++) {
                 ~~^~~~~~~~~~~~~~~~~~~
Anthony.cpp:72:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < adjList[u].size(); i++) {
                     ~~^~~~~~~~~~~~~~~~~~~
Anthony.cpp:78:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < adjList[u].size(); i++) {
                     ~~^~~~~~~~~~~~~~~~~~~
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:98:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (i = 0; i < adjList[u].size(); i++) {
                         ~~^~~~~~~~~~~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 62 ms 16264 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 15656 KB Output is correct
4 Correct 65 ms 17008 KB Output is correct
5 Correct 69 ms 17248 KB Output is correct
6 Correct 55 ms 16076 KB Output is correct
7 Correct 62 ms 15984 KB Output is correct
8 Correct 64 ms 16800 KB Output is correct
9 Correct 60 ms 16944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 16264 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 49 ms 15656 KB Output is correct
4 Correct 65 ms 17008 KB Output is correct
5 Correct 69 ms 17248 KB Output is correct
6 Correct 55 ms 16076 KB Output is correct
7 Correct 62 ms 15984 KB Output is correct
8 Correct 64 ms 16800 KB Output is correct
9 Correct 60 ms 16944 KB Output is correct
10 Correct 50 ms 14208 KB Output is correct
11 Correct 49 ms 14228 KB Output is correct
12 Correct 56 ms 14248 KB Output is correct
13 Correct 51 ms 14248 KB Output is correct
14 Correct 52 ms 14496 KB Output is correct
15 Correct 54 ms 14888 KB Output is correct
16 Correct 60 ms 16872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 13780 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 46 ms 13464 KB Output is correct
4 Correct 65 ms 15076 KB Output is correct
5 Correct 66 ms 15076 KB Output is correct
6 Correct 52 ms 13772 KB Output is correct
7 Correct 52 ms 13828 KB Output is correct
8 Correct 59 ms 14608 KB Output is correct
9 Correct 63 ms 14540 KB Output is correct
10 Correct 54 ms 14384 KB Output is correct
11 Correct 55 ms 14368 KB Output is correct
12 Correct 55 ms 14376 KB Output is correct
13 Correct 57 ms 14156 KB Output is correct
14 Correct 57 ms 14540 KB Output is correct
15 Correct 60 ms 14828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 13780 KB Output is correct
2 Correct 9 ms 1536 KB Output is correct
3 Correct 46 ms 13464 KB Output is correct
4 Correct 65 ms 15076 KB Output is correct
5 Correct 66 ms 15076 KB Output is correct
6 Correct 52 ms 13772 KB Output is correct
7 Correct 52 ms 13828 KB Output is correct
8 Correct 59 ms 14608 KB Output is correct
9 Correct 63 ms 14540 KB Output is correct
10 Correct 54 ms 14384 KB Output is correct
11 Correct 55 ms 14368 KB Output is correct
12 Correct 55 ms 14376 KB Output is correct
13 Correct 57 ms 14156 KB Output is correct
14 Correct 57 ms 14540 KB Output is correct
15 Correct 60 ms 14828 KB Output is correct
16 Correct 47 ms 12108 KB Output is correct
17 Correct 49 ms 12284 KB Output is correct
18 Correct 47 ms 12228 KB Output is correct
19 Correct 48 ms 12300 KB Output is correct
20 Correct 56 ms 13076 KB Output is correct
21 Correct 52 ms 12844 KB Output is correct
22 Correct 57 ms 14796 KB Output is correct
23 Correct 49 ms 12460 KB Output is correct
24 Correct 49 ms 12476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1536 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 10596 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 10740 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -