답안 #562969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
562969 2022-05-15T20:44:24 Z aryan12 Amusement Park (JOI17_amusement_park) C++17
10 / 100
20 ms 3308 KB
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;

#define MAXN 10010
#define INF 1000000000

static vector<int> g[MAXN];
static vector<long long> dist(MAXN, INF);

void Joi(int N, int M, int A[], int B[], long long X, int T) 
{
    for(int i = 0; i < M; i++)
    {
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    for(int i = 0; i < N; i++) 
    {
        long long x = i % 60;
        if(X & (1LL << x))
        {
            MessageBoard(i, 1);
        }
        else
        {
            MessageBoard(i, 0);
        }
    }
    // cout << "hello" << endl;
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;

#define MAXN 10010
#define INF 1000000000

static vector<int> g[MAXN];
static vector<long long> dist(MAXN, INF);
static vector<bool> vis(MAXN, false);
static vector<int> parent(MAXN);

static long long ans = 0, subtask;
static set<int> already_taken;

static int Find(int x)
{
    if(x == parent[x]) return x;
    return parent[x] = Find(parent[x]);
}

static void Unite(int a, int b)
{
    a = Find(a), b = Find(b);
    parent[a] = b;
}

static void dfs(int node, int par, long long val)
{
    // cout << "node = " << node << ", val = " << val << "\n";
    // cout << "ans = " << ans << "\n";
    if(vis[node % 60])
    {
        assert(par != -1);
        int value = Move(par);
        return;
    }
    vis[node % 60] = true;
    if(val == 1 && !already_taken.count(node % 60))
    {
        long long x = node % 60;
        ans += (1LL << x);
        already_taken.insert(x);
    }
    for(int to: g[node])
    {
        // cout << "to: " << to << "\n";
        if(!vis[to] || (subtask == 3 && !vis[to % 60]))
        {
            int value = Move(to);
            dfs(to, node, value);
        }
    }
    if(par != -1)
    {
        int value = Move(par);
    }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) 
{
    subtask = T;
    // cout << "hello" << endl;
    for(long long i = 0; i < N; i++)
    {
        parent[i] = i;
    }
    int cnt = 0;
    for(int i = 0; i < M; i++)
    {
        if(Find(A[i]) != Find(B[i]))
        {
            Unite(A[i], B[i]);
            g[A[i]].push_back(B[i]);
            g[B[i]].push_back(A[i]);
            cnt++;
        }
    }
    // cout << "hello" << endl;
    assert(cnt == N - 1);
    // cout << "hello x2" << endl;
    dfs(P, -1, (long long)(V));
    // cout << "hello x3" << endl;
    return ans;
}

Compilation message

Ioi.cpp: In function 'void dfs(int, int, long long int)':
Ioi.cpp:35:13: warning: unused variable 'value' [-Wunused-variable]
   35 |         int value = Move(par);
      |             ^~~~~
Ioi.cpp:56:13: warning: unused variable 'value' [-Wunused-variable]
   56 |         int value = Move(par);
      |             ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1288 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 3308 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1276 KB Output is correct
2 Correct 2 ms 1280 KB Output is correct
3 Correct 2 ms 1280 KB Output is correct
4 Correct 3 ms 1576 KB Output is correct
5 Correct 4 ms 1580 KB Output is correct
6 Correct 2 ms 1588 KB Output is correct
7 Correct 3 ms 1508 KB Output is correct
8 Correct 2 ms 1580 KB Output is correct
9 Correct 9 ms 2904 KB Output is correct
10 Correct 15 ms 2836 KB Output is correct
11 Correct 11 ms 2924 KB Output is correct
12 Correct 2 ms 1288 KB Output is correct
13 Correct 1 ms 1292 KB Output is correct
14 Correct 1 ms 1332 KB Output is correct
15 Correct 2 ms 1292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 3272 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 3304 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -