Submission #411029

# Submission time Handle Problem Language Result Execution time Memory
411029 2021-05-24T07:05:16 Z 조영욱(#7633) Stray Cat (JOI20_stray) C++17
15 / 100
62 ms 19188 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;

namespace {
vector<P> adj[100000];
vector<int> ret;
int dist[100000];
int pr[100000];

}

vector<int> Mark(int n,int m,int a,int b,vector<int> u,vector<int> v) {
    for(int i=0;i<m;i++) {
        adj[u[i]].push_back(P(v[i],i));
        adj[v[i]].push_back(P(u[i],i));
    }
    ret.resize(m);
    queue<int> q;
    q.push(0);
    memset(dist,-1,sizeof(dist));
    dist[0]=0;
    memset(pr,0,sizeof(pr));
    while (!q.empty()) {
        int now=q.front();
        q.pop();
        for(int i=0;i<adj[now].size();i++) {
            int nt=adj[now][i].first;
            if (dist[nt]==-1) {
                q.push(nt);
                dist[nt]=dist[now]+1;
                ret[adj[now][i].second]=dist[now]%3;
                pr[nt]=now;
            }
            else {
                if (nt==pr[now]) {
                    continue;
                }
                if (dist[nt]==dist[now]+1) {
                    ret[adj[now][i].second]=dist[now]%3;
                }
                else if (dist[now]==dist[nt]) {
                    ret[adj[now][i].second]=dist[now]%3;
                }
                else if (dist[nt]==dist[now]-1) {
                    ret[adj[now][i].second]=(dist[now]+2)%3;
                }
            }
        }
    }
    return ret;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

void Init(int A, int B) {

}

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

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:29:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int i=0;i<adj[now].size();i++) {
      |                     ~^~~~~~~~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:11:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0;i<y.size();i++) {
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 49 ms 18072 KB Output is correct
2 Correct 3 ms 3692 KB Output is correct
3 Correct 38 ms 17352 KB Output is correct
4 Correct 62 ms 19104 KB Output is correct
5 Correct 57 ms 19108 KB Output is correct
6 Correct 44 ms 17848 KB Output is correct
7 Correct 52 ms 17864 KB Output is correct
8 Correct 54 ms 18580 KB Output is correct
9 Correct 55 ms 18560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 18072 KB Output is correct
2 Correct 3 ms 3692 KB Output is correct
3 Correct 38 ms 17352 KB Output is correct
4 Correct 62 ms 19104 KB Output is correct
5 Correct 57 ms 19108 KB Output is correct
6 Correct 44 ms 17848 KB Output is correct
7 Correct 52 ms 17864 KB Output is correct
8 Correct 54 ms 18580 KB Output is correct
9 Correct 55 ms 18560 KB Output is correct
10 Correct 45 ms 15980 KB Output is correct
11 Correct 43 ms 16028 KB Output is correct
12 Correct 47 ms 15924 KB Output is correct
13 Correct 41 ms 16292 KB Output is correct
14 Correct 44 ms 16680 KB Output is correct
15 Correct 49 ms 17048 KB Output is correct
16 Correct 53 ms 19188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 15732 KB Output is correct
2 Correct 3 ms 3700 KB Output is correct
3 Correct 37 ms 15324 KB Output is correct
4 Correct 56 ms 16812 KB Output is correct
5 Correct 60 ms 16904 KB Output is correct
6 Correct 41 ms 15612 KB Output is correct
7 Correct 41 ms 15664 KB Output is correct
8 Correct 56 ms 16332 KB Output is correct
9 Correct 50 ms 16244 KB Output is correct
10 Correct 47 ms 16024 KB Output is correct
11 Correct 47 ms 16088 KB Output is correct
12 Correct 46 ms 16024 KB Output is correct
13 Correct 51 ms 15992 KB Output is correct
14 Correct 52 ms 16292 KB Output is correct
15 Correct 50 ms 16336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 15732 KB Output is correct
2 Correct 3 ms 3700 KB Output is correct
3 Correct 37 ms 15324 KB Output is correct
4 Correct 56 ms 16812 KB Output is correct
5 Correct 60 ms 16904 KB Output is correct
6 Correct 41 ms 15612 KB Output is correct
7 Correct 41 ms 15664 KB Output is correct
8 Correct 56 ms 16332 KB Output is correct
9 Correct 50 ms 16244 KB Output is correct
10 Correct 47 ms 16024 KB Output is correct
11 Correct 47 ms 16088 KB Output is correct
12 Correct 46 ms 16024 KB Output is correct
13 Correct 51 ms 15992 KB Output is correct
14 Correct 52 ms 16292 KB Output is correct
15 Correct 50 ms 16336 KB Output is correct
16 Correct 38 ms 14100 KB Output is correct
17 Correct 38 ms 14016 KB Output is correct
18 Correct 39 ms 14140 KB Output is correct
19 Correct 40 ms 14368 KB Output is correct
20 Correct 47 ms 15060 KB Output is correct
21 Correct 43 ms 14824 KB Output is correct
22 Correct 50 ms 16820 KB Output is correct
23 Correct 41 ms 14692 KB Output is correct
24 Correct 41 ms 14672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3688 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 4876 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5016 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -