답안 #731556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
731556 2023-04-27T14:32:19 Z ogibogi2004 게임 (APIO22_game) C++17
2 / 100
4 ms 7248 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=3e5+6;
const int SQ=600;
int min_nxt[MAXN];
vector<int>gr[MAXN];
int n,k;
void init(int _n, int _k) {
    n=_n;k=_k;
    for(int i=0;i<n;++i)
    {
        min_nxt[i]=n+1;
    }
}
bool set_min(int u,int val)
{
    min_nxt[u]=val;
    if(u<k&&min_nxt[u]<=u)return 1;
    for(auto xd:gr[u])
    {
        if(min_nxt[xd]>val)
        {
            bool flag=set_min(xd,val);
            if(flag==1)return 1;
        }
    }
    return 0;
}
void add_edge(int v,int u)
{
    if(gr[u].size()>SQ)
    {
        gr[v].push_back(u);
    }
    for(auto xd:gr[u])gr[v].push_back(xd);
}
int add_teleporter(int u, int v) {
    add_edge(v,u);
    if(u<k&&v<k)
    {
        if(u>=v)return 1;
        else return 0;
    }
    if(v<k)
    {
        if(v>=min_nxt[u])
        {
            //add_edge(v,u);
            //gr[v].push_back(u);
            return 0;
        }
        bool flag=set_min(u,v);
        //gr[v].push_back(u);
        return flag;
    }
    else if(min_nxt[v]>=min_nxt[u])
    {
        //gr[v].push_back(u);
        return 0;
    }
    bool flag=set_min(u,min_nxt[v]);

    //gr[v].push_back(u);
    return flag;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Incorrect 4 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Incorrect 4 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Incorrect 4 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Incorrect 4 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -