Submission #939071

# Submission time Handle Problem Language Result Execution time Memory
939071 2024-03-06T05:16:15 Z guagua0407 Stray Cat (JOI20_stray) C++17
15 / 100
46 ms 16752 KB
#include "Anthony.h"
#include <vector>
#include<bits/stdc++.h>

namespace {

using namespace std;
#define f first
#define s second
int A,B;
const int mxn=2e4+5;
vector<pair<int,int>> adj[mxn];
vector<int> ans;
bool visited[mxn];
int depth[mxn];
int par[mxn];

void dfs(int v,int p=-1,int c=2){
    visited[v]=true;
    for(auto u:adj[v]){
        if(visited[u.f]){
            if(u.f!=p and depth[u.f]<depth[v]){
                ans[u.s]=3;
            }
            continue;
        }
        ans[u.s]=(c+1)%3;
        depth[u.f]=depth[v]+1;
        dfs(u.f,v,ans[u.s]);
    }
}

void bfs(){
    queue<pair<int,int>> q;
    q.push({0,0});
    visited[0]=true;
    while(!q.empty()){
        int v=q.front().f;
        int c=q.front().s;
        q.pop();
        for(auto u:adj[v]){
            if(visited[u.f]){
                if(u.f!=par[v]){
                    if(depth[v]==depth[u.f]){
                        ans[u.s]=(c+1)%3;
                    }
                    else if(depth[v]<depth[u.f]){
                        ans[u.s]=(c+1)%3;
                    }
                }
                continue;
            }
            visited[u.f]=true;
            ans[u.s]=(c+1)%3;
            depth[u.f]=depth[v]+1;
            q.push({u.f,ans[u.s]});
        }
    }
}

}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,std::vector<int> U, std::vector<int> V) {
    ::A = A;
    ::B = B;
    ans.resize(M);
    for(int i=0;i<M;i++){
        adj[U[i]].push_back({V[i],i});
        adj[V[i]].push_back({U[i],i});
    }
    bfs();
    return ans;
}
#include "Catherine.h"
#include <vector>
#include<bits/stdc++.h>
namespace {
using namespace std;
int A, B;
int variable_example = 0;

}  // namespace

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

int Move(std::vector<int> y) {
    vector<int> pos;
    for(int i=0;i<(int)y.size();i++){
        if(y[i]>0) pos.push_back(i);
    }
    if((int)pos.size()==1) return pos[0];
    else{
        if((pos[0]+1)%3==pos[1]) return pos[0];
        else return pos[1];
    }
}

Compilation message

Catherine.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 28 ms 15744 KB Output is correct
2 Correct 1 ms 1288 KB Output is correct
3 Correct 25 ms 15192 KB Output is correct
4 Correct 34 ms 16728 KB Output is correct
5 Correct 34 ms 16752 KB Output is correct
6 Correct 27 ms 15732 KB Output is correct
7 Correct 26 ms 15500 KB Output is correct
8 Correct 32 ms 16216 KB Output is correct
9 Correct 46 ms 16416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 15744 KB Output is correct
2 Correct 1 ms 1288 KB Output is correct
3 Correct 25 ms 15192 KB Output is correct
4 Correct 34 ms 16728 KB Output is correct
5 Correct 34 ms 16752 KB Output is correct
6 Correct 27 ms 15732 KB Output is correct
7 Correct 26 ms 15500 KB Output is correct
8 Correct 32 ms 16216 KB Output is correct
9 Correct 46 ms 16416 KB Output is correct
10 Correct 26 ms 13676 KB Output is correct
11 Correct 25 ms 13676 KB Output is correct
12 Correct 28 ms 13688 KB Output is correct
13 Correct 26 ms 13632 KB Output is correct
14 Correct 26 ms 13936 KB Output is correct
15 Correct 28 ms 14200 KB Output is correct
16 Correct 36 ms 16692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 13148 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 23 ms 13440 KB Output is correct
4 Correct 41 ms 14640 KB Output is correct
5 Correct 37 ms 14620 KB Output is correct
6 Correct 30 ms 13176 KB Output is correct
7 Correct 26 ms 13168 KB Output is correct
8 Correct 31 ms 13956 KB Output is correct
9 Correct 31 ms 13948 KB Output is correct
10 Correct 30 ms 13684 KB Output is correct
11 Correct 30 ms 13680 KB Output is correct
12 Correct 36 ms 13680 KB Output is correct
13 Correct 34 ms 13668 KB Output is correct
14 Correct 39 ms 13872 KB Output is correct
15 Correct 30 ms 13956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 13148 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 23 ms 13440 KB Output is correct
4 Correct 41 ms 14640 KB Output is correct
5 Correct 37 ms 14620 KB Output is correct
6 Correct 30 ms 13176 KB Output is correct
7 Correct 26 ms 13168 KB Output is correct
8 Correct 31 ms 13956 KB Output is correct
9 Correct 31 ms 13948 KB Output is correct
10 Correct 30 ms 13684 KB Output is correct
11 Correct 30 ms 13680 KB Output is correct
12 Correct 36 ms 13680 KB Output is correct
13 Correct 34 ms 13668 KB Output is correct
14 Correct 39 ms 13872 KB Output is correct
15 Correct 30 ms 13956 KB Output is correct
16 Correct 23 ms 11624 KB Output is correct
17 Correct 23 ms 11636 KB Output is correct
18 Correct 26 ms 11760 KB Output is correct
19 Correct 24 ms 11632 KB Output is correct
20 Correct 27 ms 12288 KB Output is correct
21 Correct 26 ms 12144 KB Output is correct
22 Correct 28 ms 14200 KB Output is correct
23 Correct 25 ms 11852 KB Output is correct
24 Correct 30 ms 11896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1308 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2592 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2592 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -