Submission #924185

# Submission time Handle Problem Language Result Execution time Memory
924185 2024-02-08T15:59:47 Z Tuanlinh123 Stray Cat (JOI20_stray) C++17
15 / 100
37 ms 16724 KB
#include "Anthony.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

vector <ll> s={0, 1, 0, 0, 1, 1};
vector <ll> Mark(ll n, ll m, ll a, ll b, vector <ll> U, vector <ll> V)
{
    vector <ll> ans(m);
    vector <vector <pll>> A(n);
    for (ll i=0; i<m; i++)
        A[U[i]].pb({V[i], i}), A[V[i]].pb({U[i], i});
    vector <ll> dep(n, 0);
    auto bfs=[&]()
    {
        queue <ll> q; q.push(0), dep[0]=1;
        while (!q.empty())
        {
            ll u=q.front(); q.pop();
            for (auto [v, id]:A[u])
            {
                if (!dep[v])
                    q.push(v), dep[v]=dep[u]+1;
                ans[id]=min(dep[u], dep[v])%3;
            }
        }
    };
    function <void(int, int)> dfs=[&](ll u, ll pa)
    {
        ll cnt=A[u].size()-(pa!=-1);
        for (auto [v, id]:A[u])
        {
            if (v==pa) continue;
            if (cnt==1 || pa==-1) 
                ans[id]=s[dep[u]], dep[v]=(dep[u]+1)%6;
            else ans[id]=s[(dep[u]+5)%6]^1, dep[v]=ans[id]^1;
            dfs(v, u);
        }
    };
    if (a>2) bfs();
    else dfs(0, -1);
    return ans;
}
#include "Catherine.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

string crr;
ll A, B, cnt, ok, last;
void Init(ll a, ll b) {A=a, B=b;}

ll Move(vector <ll> y)
{
    if (A>2)
    {
        if (!y[0] && !y[1]) return 2;
        if (!y[2] && !y[1]) return 0;
        if (!y[0] && !y[2]) return 1;
        if (y[0] && y[1]) return 0;
        if (y[1] && y[2]) return 1;
        return 2;
    }
    if (ok)
    {
        if (y[0]>1) return last=1;
        if (y[1]>1) return last=0;
        return last=last^1;
    }
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 15748 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 24 ms 15160 KB Output is correct
4 Correct 34 ms 16656 KB Output is correct
5 Correct 36 ms 16724 KB Output is correct
6 Correct 32 ms 15468 KB Output is correct
7 Correct 28 ms 15484 KB Output is correct
8 Correct 33 ms 16212 KB Output is correct
9 Correct 32 ms 16164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 15748 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 24 ms 15160 KB Output is correct
4 Correct 34 ms 16656 KB Output is correct
5 Correct 36 ms 16724 KB Output is correct
6 Correct 32 ms 15468 KB Output is correct
7 Correct 28 ms 15484 KB Output is correct
8 Correct 33 ms 16212 KB Output is correct
9 Correct 32 ms 16164 KB Output is correct
10 Correct 30 ms 13644 KB Output is correct
11 Correct 26 ms 13636 KB Output is correct
12 Correct 26 ms 13640 KB Output is correct
13 Correct 26 ms 13640 KB Output is correct
14 Correct 26 ms 13892 KB Output is correct
15 Correct 28 ms 14140 KB Output is correct
16 Correct 32 ms 16224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 13148 KB Output is correct
2 Correct 0 ms 796 KB Output is correct
3 Correct 25 ms 12984 KB Output is correct
4 Correct 32 ms 14596 KB Output is correct
5 Correct 32 ms 14676 KB Output is correct
6 Correct 26 ms 13172 KB Output is correct
7 Correct 26 ms 13140 KB Output is correct
8 Correct 37 ms 14204 KB Output is correct
9 Correct 28 ms 13876 KB Output is correct
10 Correct 28 ms 13704 KB Output is correct
11 Correct 27 ms 13632 KB Output is correct
12 Correct 27 ms 13692 KB Output is correct
13 Correct 27 ms 13948 KB Output is correct
14 Correct 36 ms 13944 KB Output is correct
15 Correct 30 ms 13856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 13148 KB Output is correct
2 Correct 0 ms 796 KB Output is correct
3 Correct 25 ms 12984 KB Output is correct
4 Correct 32 ms 14596 KB Output is correct
5 Correct 32 ms 14676 KB Output is correct
6 Correct 26 ms 13172 KB Output is correct
7 Correct 26 ms 13140 KB Output is correct
8 Correct 37 ms 14204 KB Output is correct
9 Correct 28 ms 13876 KB Output is correct
10 Correct 28 ms 13704 KB Output is correct
11 Correct 27 ms 13632 KB Output is correct
12 Correct 27 ms 13692 KB Output is correct
13 Correct 27 ms 13948 KB Output is correct
14 Correct 36 ms 13944 KB Output is correct
15 Correct 30 ms 13856 KB Output is correct
16 Correct 24 ms 11608 KB Output is correct
17 Correct 23 ms 11600 KB Output is correct
18 Correct 27 ms 11556 KB Output is correct
19 Correct 24 ms 11592 KB Output is correct
20 Correct 34 ms 12560 KB Output is correct
21 Correct 26 ms 12092 KB Output is correct
22 Correct 28 ms 13980 KB Output is correct
23 Correct 25 ms 11860 KB Output is correct
24 Correct 25 ms 11864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1124 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 11388 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 11392 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -