답안 #261113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
261113 2020-08-11T11:57:54 Z sjimed 길고양이 (JOI20_stray) C++14
85 / 100
70 ms 15740 KB
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

static vector<pii> g[20010];
static vector<int> ret;
static int tb[6] = {0, 1, 0, 0, 1, 1};

static void dfs(int x, int p, int k) {
  int t = 1 - tb[k];
  if(x != 0 && g[x].size() == 2) t = (k + 1) % 6;

  for(auto i : g[x]) {
    if(i.fi == p) continue;
  
    ret[i.se] = tb[t];
    dfs(i.fi, x, t);
  }
}

std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {  
  for(int i=0; i<M; i++) 
    g[U[i]].eb(V[i], i), g[V[i]].eb(U[i], i);

  ret.resize(M, 0);
  dfs(0, 0, 0);

  /*for(auto i : ret) {
    cout << i;
  }
  cout << endl;*/

  return ret;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
 
static int typ;
void Init(int A, int B){
    if(A>=3)typ=1;
    else typ=2;
}
 
static int move_typeA(vector<int> vc){
    for(int i=0; i<3; i++)if(vc[i]&&!vc[(i+2)%3])return i;
}
 
static int rpt[6]={0, 1, 0, 0, 1, 1};
static bool fnd;
static int cnt, prv=-1, mask;
static int move_typeB(vector<int> vc){
    cnt++;
    int deg=vc[0]+vc[1];
    if(prv>=0)deg++;
    if(fnd){
        if(deg>=3){
            prv=1-prv;
            return prv;
        }
        if(vc[0])prv=0;
        else prv=1;
        return prv;
    }
    if(deg==1){
        fnd=true;
        if(cnt>1)return -1;
        if(vc[0])prv=0;
        else prv=1;
        return prv;
    }
    if(deg>=3){
        if(cnt>1)vc[prv]++;
        fnd=true;
        int tmp;
        if(vc[0]==1)tmp=0;
        else tmp=1;
        if(tmp==prv&&cnt>1)return -1;
        prv=tmp;
        return tmp;
    }
    if(cnt<=3){
        if(vc[0])prv=0;
        else prv=1;
        if(cnt==1)mask*=2, mask+=vc[1]-prv;
        mask*=2, mask+=prv;
        return prv;
    }
    if(cnt==4){
        fnd=true;
        int opp;
        if(vc[0])opp=0;
        else opp=1;
        mask*=2, mask+=opp;
        if(mask==25||mask==18||mask==5||mask==11||mask==22||mask==12){
            prv=opp;
            return prv;
        }
        return -1;
    }
}
 
int Move(vector<int> y){
    if(typ==1)return move_typeA(y);
    return move_typeB(y);
}

Compilation message

Catherine.cpp: In function 'int move_typeA(std::vector<int>)':
Catherine.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Catherine.cpp: In function 'int move_typeB(std::vector<int>)':
Catherine.cpp:72:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Catherine.cpp: At global scope:
Catherine.cpp:20:12: warning: 'rpt' defined but not used [-Wunused-variable]
 static int rpt[6]={0, 1, 0, 0, 1, 1};
            ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 15740 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 15740 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 13684 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 13684 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 2 ms 1536 KB Output is correct
3 Correct 2 ms 1536 KB Output is correct
4 Correct 2 ms 1792 KB Output is correct
5 Correct 2 ms 1792 KB Output is correct
6 Correct 2 ms 1796 KB Output is correct
7 Correct 3 ms 1792 KB Output is correct
8 Correct 2 ms 1792 KB Output is correct
9 Correct 2 ms 1792 KB Output is correct
10 Correct 2 ms 1800 KB Output is correct
11 Correct 2 ms 1792 KB Output is correct
12 Correct 2 ms 1792 KB Output is correct
13 Correct 3 ms 1792 KB Output is correct
14 Correct 2 ms 1792 KB Output is correct
15 Correct 2 ms 1792 KB Output is correct
16 Correct 2 ms 1536 KB Output is correct
17 Correct 2 ms 1536 KB Output is correct
18 Correct 2 ms 1536 KB Output is correct
19 Correct 2 ms 1792 KB Output is correct
20 Correct 2 ms 1792 KB Output is correct
21 Correct 2 ms 1536 KB Output is correct
22 Correct 2 ms 1536 KB Output is correct
23 Correct 2 ms 1792 KB Output is correct
24 Correct 2 ms 1536 KB Output is correct
25 Correct 2 ms 1792 KB Output is correct
26 Correct 2 ms 1792 KB Output is correct
27 Correct 3 ms 1792 KB Output is correct
28 Correct 2 ms 1804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 11516 KB Output is correct
2 Correct 50 ms 13096 KB Output is correct
3 Correct 1 ms 1536 KB Output is correct
4 Correct 38 ms 11424 KB Output is correct
5 Correct 57 ms 14156 KB Output is correct
6 Correct 56 ms 14268 KB Output is correct
7 Correct 44 ms 13328 KB Output is correct
8 Correct 45 ms 13396 KB Output is correct
9 Correct 61 ms 14296 KB Output is correct
10 Correct 62 ms 14352 KB Output is correct
11 Correct 69 ms 14156 KB Output is correct
12 Correct 59 ms 14348 KB Output is correct
13 Correct 58 ms 14292 KB Output is correct
14 Correct 61 ms 14224 KB Output is correct
15 Correct 64 ms 14208 KB Output is correct
16 Correct 61 ms 14220 KB Output is correct
17 Correct 54 ms 13772 KB Output is correct
18 Correct 54 ms 13908 KB Output is correct
19 Correct 54 ms 13972 KB Output is correct
20 Correct 53 ms 13984 KB Output is correct
21 Correct 57 ms 13980 KB Output is correct
22 Correct 52 ms 13968 KB Output is correct
23 Correct 44 ms 11868 KB Output is correct
24 Correct 43 ms 11860 KB Output is correct
25 Correct 44 ms 12256 KB Output is correct
26 Correct 54 ms 12316 KB Output is correct
27 Correct 53 ms 13172 KB Output is correct
28 Correct 52 ms 13140 KB Output is correct
29 Correct 54 ms 13152 KB Output is correct
30 Correct 49 ms 13212 KB Output is correct
31 Correct 43 ms 11876 KB Output is correct
32 Correct 44 ms 11876 KB Output is correct
33 Correct 43 ms 12400 KB Output is correct
34 Correct 43 ms 12264 KB Output is correct
35 Correct 51 ms 12848 KB Output is correct
36 Correct 49 ms 12912 KB Output is correct
37 Correct 51 ms 12756 KB Output is correct
38 Correct 51 ms 12888 KB Output is correct
39 Correct 49 ms 12900 KB Output is correct
40 Correct 49 ms 13136 KB Output is correct
41 Correct 51 ms 13652 KB Output is correct
42 Correct 54 ms 13952 KB Output is correct
43 Correct 54 ms 13396 KB Output is correct
44 Correct 52 ms 13496 KB Output is correct
45 Correct 53 ms 13524 KB Output is correct
46 Correct 54 ms 13632 KB Output is correct
47 Correct 51 ms 12628 KB Output is correct
48 Correct 50 ms 12820 KB Output is correct
49 Correct 48 ms 12708 KB Output is correct
50 Correct 49 ms 12884 KB Output is correct
51 Correct 45 ms 12212 KB Output is correct
52 Correct 46 ms 12212 KB Output is correct
53 Correct 46 ms 12116 KB Output is correct
54 Correct 46 ms 12200 KB Output is correct
55 Correct 53 ms 12216 KB Output is correct
56 Correct 52 ms 12212 KB Output is correct
57 Correct 47 ms 11976 KB Output is correct
58 Correct 52 ms 11960 KB Output is correct
59 Correct 45 ms 12000 KB Output is correct
60 Correct 44 ms 11988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 11612 KB Output is correct
2 Correct 47 ms 12832 KB Output is correct
3 Correct 1 ms 1536 KB Output is correct
4 Correct 38 ms 11444 KB Output is correct
5 Correct 54 ms 14224 KB Output is correct
6 Correct 56 ms 14352 KB Output is correct
7 Correct 56 ms 13332 KB Output is correct
8 Correct 47 ms 13460 KB Output is correct
9 Correct 59 ms 14292 KB Output is correct
10 Correct 58 ms 14268 KB Output is correct
11 Correct 60 ms 14232 KB Output is correct
12 Correct 60 ms 14288 KB Output is correct
13 Correct 70 ms 14284 KB Output is correct
14 Correct 56 ms 14340 KB Output is correct
15 Correct 56 ms 14224 KB Output is correct
16 Correct 55 ms 14156 KB Output is correct
17 Correct 51 ms 13980 KB Output is correct
18 Correct 54 ms 13976 KB Output is correct
19 Correct 61 ms 13880 KB Output is correct
20 Correct 55 ms 14036 KB Output is correct
21 Correct 51 ms 13980 KB Output is correct
22 Correct 52 ms 14036 KB Output is correct
23 Correct 41 ms 11872 KB Output is correct
24 Correct 46 ms 11848 KB Output is correct
25 Correct 45 ms 12112 KB Output is correct
26 Correct 45 ms 12292 KB Output is correct
27 Correct 54 ms 13080 KB Output is correct
28 Correct 52 ms 13004 KB Output is correct
29 Correct 50 ms 13196 KB Output is correct
30 Correct 50 ms 13408 KB Output is correct
31 Correct 43 ms 11880 KB Output is correct
32 Correct 41 ms 12008 KB Output is correct
33 Correct 44 ms 12208 KB Output is correct
34 Correct 47 ms 12720 KB Output is correct
35 Correct 50 ms 12756 KB Output is correct
36 Correct 48 ms 12896 KB Output is correct
37 Correct 48 ms 12876 KB Output is correct
38 Correct 48 ms 12884 KB Output is correct
39 Correct 49 ms 12848 KB Output is correct
40 Correct 50 ms 12884 KB Output is correct
41 Correct 58 ms 13644 KB Output is correct
42 Correct 61 ms 13620 KB Output is correct
43 Correct 59 ms 13704 KB Output is correct
44 Correct 57 ms 13516 KB Output is correct
45 Correct 61 ms 13708 KB Output is correct
46 Correct 62 ms 13568 KB Output is correct
47 Correct 57 ms 12756 KB Output is correct
48 Correct 54 ms 12824 KB Output is correct
49 Correct 51 ms 12820 KB Output is correct
50 Correct 55 ms 12876 KB Output is correct
51 Correct 44 ms 12212 KB Output is correct
52 Correct 49 ms 12212 KB Output is correct
53 Correct 45 ms 12212 KB Output is correct
54 Correct 44 ms 12224 KB Output is correct
55 Correct 43 ms 12212 KB Output is correct
56 Correct 45 ms 12208 KB Output is correct
57 Correct 44 ms 12212 KB Output is correct
58 Correct 44 ms 12212 KB Output is correct
59 Correct 44 ms 12256 KB Output is correct
60 Correct 49 ms 12260 KB Output is correct