답안 #260849

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260849 2020-08-11T05:50:23 Z 최은수(#5044) 길고양이 (JOI20_stray) C++17
15 / 100
71 ms 16344 KB
#include"Anthony.h"
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
vector<int>Mark(int N,int M,int A,int B,vector<int>U,vector<int>V)
{
    int n=N;
    int m=M;
    int a=min(A,3);
    vector<vector<int> >adj(n);
    for(int i=0;i<m;i++)
        adj[U[i]].eb(V[i]),adj[V[i]].eb(U[i]);
    vector<int>dis(n,inf);
    queue<int>q;
    dis[0]=0;
    q.ep(0);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        for(int&t:adj[x])
            if(dis[t]==inf)
                dis[t]=dis[x]+1,q.ep(t);
    }
    vector<int>col(m,0);
    if(a==2)
    {
        const int pat[6]={0,0,1,0,1,1};
        vector<int>pai(n,-1);
        for(int i=0;i<m;i++)
            pai[dis[U[i]]>dis[V[i]]?U[i]:V[i]]=i;
        fill(all(dis),inf);
        dis[0]=0;
        q.ep(0);
        while(!q.empty())
        {
            int x=q.front();
            q.pop();
            if(x!=0)
                col[pai[x]]=pat[dis[x]];
            for(int&t:adj[x])
            {
                if(dis[t]==inf)
                {
                    if(x==0)
                        dis[t]=0;
                    else if((int)adj[x].size()>2)
                        dis[t]=(col[pai[x]]^1)*5;
                    else
                        dis[t]=(dis[x]+1)%6;
                    q.ep(t);
                }
            }
        }
    }
    else
        for(int i=0;i<m;i++)
            col[i]=(dis[U[i]]+dis[V[i]])/2%a;
    return col;
}
#include"Catherine.h"
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
static int a,prv,cnt,cur;
static int type;
static bool cor;
void Init(int A,int B)
{
    type=-1;
    cor=0;
    prv=cur=cnt=0;
    a=min(A,3);
    return;
}
int Move(vector<int>y)
{
    if(a==2)
    {
        if((prv!=-1?1:0)+y[0]+y[1]>=3)
        {
            cor=1;
            if(y[0]==0||y[1]==0)
                return-1;
            if(prv==-1)
                return prv=y[0]==1?0:1;
            return prv^=1;
        }
        if((prv!=-1?1:0)+y[0]+y[1]==1)
        {
            cor=1;
            if(y[0]==1)
                return prv=0;
            if(y[1]==1)
                return prv=1;
            return-1;
        }
        if(cor)
            return prv=y[0]==1?0:1;
        cnt++;
        if(prv==-1)
        {
            if(y[0]==0)
            {
                type=0;
                return prv=cur=0;
            }
            if(y[1]==0)
            {
                type=2;
                return prv=cur=1;
            }
            type=1;
            return prv=cur=1;
        }
        int nx=y[0]==1?0:1;
        cur=cur*2+nx;
        if(cnt==4)
        {
            cor=1;
            if(cur==5||cur==11||cur==12||(cur==9&&type==2))
                return-1;
            return prv=nx;
        }
        return prv=nx;
    }
    int c=0;
    for(int i=0;i<3;i++)
        if(y[i]>0)
            c+=3+i;
    if(c<6)
        return c-3;
    for(int i=0;i<3;i++)
        if(y[i]==0)
            return(i+1)%3;
    return a;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 15252 KB Output is correct
2 Correct 1 ms 792 KB Output is correct
3 Correct 46 ms 14720 KB Output is correct
4 Correct 68 ms 16244 KB Output is correct
5 Correct 65 ms 16344 KB Output is correct
6 Correct 52 ms 14964 KB Output is correct
7 Correct 49 ms 15296 KB Output is correct
8 Correct 56 ms 15604 KB Output is correct
9 Correct 56 ms 15832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 15252 KB Output is correct
2 Correct 1 ms 792 KB Output is correct
3 Correct 46 ms 14720 KB Output is correct
4 Correct 68 ms 16244 KB Output is correct
5 Correct 65 ms 16344 KB Output is correct
6 Correct 52 ms 14964 KB Output is correct
7 Correct 49 ms 15296 KB Output is correct
8 Correct 56 ms 15604 KB Output is correct
9 Correct 56 ms 15832 KB Output is correct
10 Correct 48 ms 13048 KB Output is correct
11 Correct 44 ms 13152 KB Output is correct
12 Correct 44 ms 13176 KB Output is correct
13 Correct 44 ms 13176 KB Output is correct
14 Correct 45 ms 13484 KB Output is correct
15 Correct 52 ms 13580 KB Output is correct
16 Correct 55 ms 15976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 12888 KB Output is correct
2 Correct 1 ms 744 KB Output is correct
3 Correct 38 ms 12284 KB Output is correct
4 Correct 58 ms 14432 KB Output is correct
5 Correct 60 ms 14436 KB Output is correct
6 Correct 47 ms 12864 KB Output is correct
7 Correct 46 ms 12868 KB Output is correct
8 Correct 56 ms 13656 KB Output is correct
9 Correct 56 ms 13564 KB Output is correct
10 Correct 50 ms 13404 KB Output is correct
11 Correct 50 ms 13180 KB Output is correct
12 Correct 52 ms 13656 KB Output is correct
13 Correct 52 ms 13528 KB Output is correct
14 Correct 62 ms 13576 KB Output is correct
15 Correct 71 ms 13664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 12888 KB Output is correct
2 Correct 1 ms 744 KB Output is correct
3 Correct 38 ms 12284 KB Output is correct
4 Correct 58 ms 14432 KB Output is correct
5 Correct 60 ms 14436 KB Output is correct
6 Correct 47 ms 12864 KB Output is correct
7 Correct 46 ms 12868 KB Output is correct
8 Correct 56 ms 13656 KB Output is correct
9 Correct 56 ms 13564 KB Output is correct
10 Correct 50 ms 13404 KB Output is correct
11 Correct 50 ms 13180 KB Output is correct
12 Correct 52 ms 13656 KB Output is correct
13 Correct 52 ms 13528 KB Output is correct
14 Correct 62 ms 13576 KB Output is correct
15 Correct 71 ms 13664 KB Output is correct
16 Correct 41 ms 11088 KB Output is correct
17 Correct 47 ms 11164 KB Output is correct
18 Correct 48 ms 11248 KB Output is correct
19 Correct 43 ms 11128 KB Output is correct
20 Correct 50 ms 11788 KB Output is correct
21 Correct 52 ms 11520 KB Output is correct
22 Correct 61 ms 13684 KB Output is correct
23 Correct 45 ms 11376 KB Output is correct
24 Correct 45 ms 11380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1132 KB Output is correct
2 Correct 1 ms 644 KB Output is correct
3 Correct 2 ms 940 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 2 ms 1036 KB Output is correct
6 Correct 2 ms 1124 KB Output is correct
7 Incorrect 2 ms 1036 KB Wrong Answer [4]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 11004 KB Output is correct
2 Incorrect 45 ms 11028 KB Wrong Answer [4]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 11108 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -