Submission #513251

# Submission time Handle Problem Language Result Execution time Memory
513251 2022-01-17T04:39:58 Z wiwiho Stray Cat (JOI20_stray) C++14
5 / 100
57 ms 15076 KB
#include "Anthony.h"
#include <bits/stdc++.h>

#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
    for(auto pv : a) b << pv << " "; \
    b << "\n"; \
}

using namespace std;

namespace {

}  // namespace

vector<int> Mark(int n, int m, int A, int B,
                      vector<int> U, vector<int> V) {

    vector<int> ans(m);

    vector<vector<int>> g(n);
    for(int i = 0; i < m; i++){
        int u = U[i], v = V[i];
        g[u].eb(v);
        g[v].eb(u);
    }

    vector<int> dis(n, -1);
    dis[0] = 0;
    queue<int> q;
    q.push(0);
    
    while(!q.empty()){
        int now = q.front();
        q.pop();
        for(int i : g[now]){
            if(dis[i] != -1) continue;
            dis[i] = dis[now] + 1;
            q.push(i);
        }
    }

    for(int i = 0; i < m; i++){
        int u = U[i], v = V[i];
        if(dis[u] > dis[v]) swap(u, v);
        int t = dis[u] == dis[v] ? dis[v] + 1 : dis[v];
        t %= 2;
        ans[i] = t;
    }

    return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>

#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
    for(auto pv : a) b << pv << " "; \
    b << "\n"; \
}

using namespace std;

namespace {

int A, B;

int lst = -1;

}  // namespace

void Init(int A, int B) {
    ::A = A;
    ::B = B;
}

int Move(vector<int> y) {
    
    vector<int> t;
    for(int i = 0; i < A; i++){
        if(y[i]) t.eb(i);
    }

    if(t.empty()) return -1;

    if(lst == -1){
        lst = t[0];
        return t[0];
    }

    lst = !lst;
    return lst;
}
# Verdict Execution time Memory Grader output
1 Correct 39 ms 15076 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Incorrect 33 ms 14388 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 15076 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Incorrect 33 ms 14388 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 12572 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Incorrect 26 ms 12260 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 12572 KB Output is correct
2 Correct 0 ms 484 KB Output is correct
3 Incorrect 26 ms 12260 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 872 KB Output is correct
2 Correct 1 ms 556 KB Output is correct
3 Correct 2 ms 888 KB Output is correct
4 Correct 2 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 2 ms 916 KB Output is correct
7 Correct 2 ms 892 KB Output is correct
8 Correct 2 ms 888 KB Output is correct
9 Correct 2 ms 876 KB Output is correct
10 Correct 2 ms 888 KB Output is correct
11 Correct 2 ms 888 KB Output is correct
12 Correct 2 ms 876 KB Output is correct
13 Correct 2 ms 888 KB Output is correct
14 Correct 2 ms 876 KB Output is correct
15 Correct 2 ms 876 KB Output is correct
16 Correct 2 ms 888 KB Output is correct
17 Correct 2 ms 888 KB Output is correct
18 Correct 2 ms 848 KB Output is correct
19 Correct 2 ms 888 KB Output is correct
20 Correct 2 ms 888 KB Output is correct
21 Correct 2 ms 836 KB Output is correct
22 Correct 2 ms 880 KB Output is correct
23 Correct 2 ms 876 KB Output is correct
24 Correct 2 ms 876 KB Output is correct
25 Correct 2 ms 888 KB Output is correct
26 Correct 2 ms 888 KB Output is correct
27 Correct 2 ms 888 KB Output is correct
28 Correct 2 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 10752 KB Output is correct
2 Correct 36 ms 11796 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 26 ms 11020 KB Output is correct
5 Correct 57 ms 12724 KB Output is correct
6 Correct 40 ms 12684 KB Output is correct
7 Incorrect 34 ms 11960 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 11000 KB Output is correct
2 Correct 34 ms 11540 KB Output is correct
3 Correct 0 ms 488 KB Output is correct
4 Correct 26 ms 10972 KB Output is correct
5 Correct 40 ms 12660 KB Output is correct
6 Correct 40 ms 12744 KB Output is correct
7 Incorrect 30 ms 12012 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -