답안 #411016

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411016 2021-05-24T06:22:06 Z 조영욱(#7633) 길고양이 (JOI20_stray) C++17
4 / 100
372 ms 524292 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;
vector<P> adj[100000];
vector<int> ret;
int depth[100000];

namespace {

void dfs(int v,int prev) {
    for(int i=0;i<adj[v].size();i++) {
        int nt=adj[v][i].first;
        if (nt==prev){
            continue;
        }
        depth[nt]=depth[v]+1;
        ret[adj[v][i].second]=depth[v]%3;
        dfs(nt,v);
    }
}
}

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);
    ::dfs(0,-1);
    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 (y[vec[0]]!=1||y[vec[1]]!=1) {
        if (y[vec[0]]==1) {
            return vec[0];
        }
        if (y[vec[1]]==1) {
            return vec[1];
        }
    }
    if ((vec[0]+1)%3==vec[1]) {
        return vec[0];
    }
    else {
        return vec[1];
    }
}

Compilation message

Anthony.cpp: In function 'void {anonymous}::dfs(int, int)':
Anthony.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<adj[v].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++) {
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 18400 KB Output is correct
2 Correct 4 ms 2936 KB Output is correct
3 Correct 40 ms 16940 KB Output is correct
4 Correct 57 ms 19992 KB Output is correct
5 Correct 61 ms 20088 KB Output is correct
6 Correct 44 ms 17744 KB Output is correct
7 Correct 44 ms 17768 KB Output is correct
8 Correct 53 ms 19072 KB Output is correct
9 Correct 54 ms 19176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 18400 KB Output is correct
2 Correct 4 ms 2936 KB Output is correct
3 Correct 40 ms 16940 KB Output is correct
4 Correct 57 ms 19992 KB Output is correct
5 Correct 61 ms 20088 KB Output is correct
6 Correct 44 ms 17744 KB Output is correct
7 Correct 44 ms 17768 KB Output is correct
8 Correct 53 ms 19072 KB Output is correct
9 Correct 54 ms 19176 KB Output is correct
10 Runtime error 289 ms 524292 KB Execution killed with signal 9
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 15972 KB Output is correct
2 Correct 3 ms 2940 KB Output is correct
3 Correct 36 ms 14844 KB Output is correct
4 Correct 66 ms 17860 KB Output is correct
5 Correct 58 ms 17924 KB Output is correct
6 Correct 43 ms 15584 KB Output is correct
7 Correct 44 ms 15576 KB Output is correct
8 Correct 49 ms 16744 KB Output is correct
9 Correct 50 ms 16752 KB Output is correct
10 Correct 47 ms 16420 KB Output is correct
11 Correct 46 ms 16568 KB Output is correct
12 Correct 55 ms 16512 KB Output is correct
13 Correct 48 ms 16528 KB Output is correct
14 Correct 54 ms 16816 KB Output is correct
15 Correct 53 ms 16760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 15972 KB Output is correct
2 Correct 3 ms 2940 KB Output is correct
3 Correct 36 ms 14844 KB Output is correct
4 Correct 66 ms 17860 KB Output is correct
5 Correct 58 ms 17924 KB Output is correct
6 Correct 43 ms 15584 KB Output is correct
7 Correct 44 ms 15576 KB Output is correct
8 Correct 49 ms 16744 KB Output is correct
9 Correct 50 ms 16752 KB Output is correct
10 Correct 47 ms 16420 KB Output is correct
11 Correct 46 ms 16568 KB Output is correct
12 Correct 55 ms 16512 KB Output is correct
13 Correct 48 ms 16528 KB Output is correct
14 Correct 54 ms 16816 KB Output is correct
15 Correct 53 ms 16760 KB Output is correct
16 Runtime error 372 ms 524292 KB Execution killed with signal 9
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2928 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 4680 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 4596 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -