Submission #699867

# Submission time Handle Problem Language Result Execution time Memory
699867 2023-02-18T07:28:53 Z cig32 Amusement Park (JOI17_amusement_park) C++17
0 / 100
26 ms 4640 KB
#include "Joi.h"
#include "bits/stdc++.h"
using namespace std;

static vector<int> adj2[12269];
static bool vis2[12269];
static int val2[12269];
static int nxt2;
static void dfs2(int node, long long X, int par) {
  val2[node] = nxt2;
  nxt2 = (nxt2 + 1) % 60;
  long long res = (X & (1ll << val2[node]));
  MessageBoard(node, (res > 0 ? 1 : 0));
  vis2[node] = 1;
  for(int x: adj2[node]) {
    if(!vis2[x]) {
      dfs2(x, X, node);
    }
  }
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
  for(int i=0; i<M; i++) {
    adj2[A[i]].push_back(B[i]);
    adj2[B[i]].push_back(A[i]);
  }
  for(int i=0; i<N; i++) {
    sort(adj2[i].begin(), adj2[i].end());
  }
  for(int i=0; i<N; i++) {
    vis2[i] = 0;
  }
  dfs2(0, X, -1);
}
#include "Ioi.h"
#include "bits/stdc++.h"
using namespace std;
const int MAXN = 1e4 + 10;
static vector<int> adj[MAXN];
static bool vis[MAXN];
static int val[MAXN];
static int nxt;
static vector<int> et;
static void dfs(int node, int par) {
  val[node] = nxt;
  nxt = (nxt+1) % 60;
  vis[node] = 1;
  et.push_back(node);
  for(int x: adj[node]) {
    if(!vis[x]) {
      dfs(x, node);
      et.push_back(node);
    }
  }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  nxt = 0;
  et.clear();
  for(int i=0; i<N; i++) {
    adj[i].clear();
  }
  for(int i=0; i<M; i++) {
    adj[A[i]].push_back(B[i]);
    adj[B[i]].push_back(A[i]);
  }
  for(int i=0; i<N; i++) {
    sort(adj[i].begin(), adj[i].end());
  }
  for(int i=0; i<N; i++) {
    vis[i] = 0;
  }
  dfs(0, -1);
  long long ans = 0;
  int res[60];
  for(int i=0; i<60; i++) res[i] = 0;
  res[val[P]] = V;
  int l[N];
  for(int i=0; i<N; i++) l[i] = -1;
  for(int i=0; i<et.size(); i++) {
    if(l[et[i]] == -1) l[et[i]] = i;
  }
  int node = P, idx = l[P];
  for(int i=val[P]-1; i>=0; i--) {
    while(idx-1 >= 0 && val[et[idx]] != i) {
      idx--;
      int rm = Move(et[idx]);
      node = et[idx];
      res[val[node]] = rm;
    }
  }
  for(int i=1; i<60; i++) {
    while(idx+1 < et.size() && val[et[idx]] != i) {
      idx++;
      int rm = Move(et[idx]);
      node = et[idx];
      res[val[node]] = rm;
    }
  }
  for(int i=0; i<60; i++) {
    if(res[i]) ans += (1ll << i);
  }
  return ans;
}

Compilation message

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:46:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   for(int i=0; i<et.size(); i++) {
      |                ~^~~~~~~~~~
Ioi.cpp:59:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |     while(idx+1 < et.size() && val[et[idx]] != i) {
      |           ~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1164 KB Output is correct
2 Incorrect 2 ms 1168 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 4608 KB Output is correct
2 Correct 23 ms 4576 KB Output is correct
3 Correct 26 ms 4544 KB Output is correct
4 Correct 16 ms 3088 KB Output is correct
5 Correct 14 ms 3312 KB Output is correct
6 Correct 14 ms 3376 KB Output is correct
7 Correct 15 ms 3364 KB Output is correct
8 Correct 16 ms 3412 KB Output is correct
9 Correct 13 ms 3332 KB Output is correct
10 Correct 12 ms 3120 KB Output is correct
11 Correct 13 ms 3104 KB Output is correct
12 Correct 11 ms 2808 KB Output is correct
13 Correct 12 ms 2800 KB Output is correct
14 Correct 16 ms 2976 KB Output is correct
15 Correct 15 ms 3076 KB Output is correct
16 Correct 15 ms 2960 KB Output is correct
17 Correct 12 ms 3036 KB Output is correct
18 Correct 16 ms 3168 KB Output is correct
19 Correct 15 ms 3020 KB Output is correct
20 Incorrect 11 ms 3612 KB Wrong Answer [7]
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1164 KB Output is correct
2 Correct 2 ms 1104 KB Output is correct
3 Correct 2 ms 1152 KB Output is correct
4 Correct 3 ms 1584 KB Output is correct
5 Correct 4 ms 1588 KB Output is correct
6 Correct 3 ms 1580 KB Output is correct
7 Correct 2 ms 1596 KB Output is correct
8 Incorrect 2 ms 1580 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 23 ms 4636 KB Partially correct
2 Correct 23 ms 4556 KB Output is correct
3 Partially correct 23 ms 4604 KB Partially correct
4 Partially correct 13 ms 3012 KB Partially correct
5 Partially correct 14 ms 3756 KB Partially correct
6 Partially correct 13 ms 3376 KB Partially correct
7 Correct 14 ms 3364 KB Output is correct
8 Correct 14 ms 3184 KB Output is correct
9 Partially correct 13 ms 3188 KB Partially correct
10 Correct 13 ms 3108 KB Output is correct
11 Partially correct 15 ms 3068 KB Partially correct
12 Partially correct 12 ms 2836 KB Partially correct
13 Partially correct 12 ms 2824 KB Partially correct
14 Partially correct 12 ms 2968 KB Partially correct
15 Partially correct 13 ms 2980 KB Partially correct
16 Partially correct 13 ms 3012 KB Partially correct
17 Partially correct 13 ms 3072 KB Partially correct
18 Partially correct 13 ms 3028 KB Partially correct
19 Partially correct 13 ms 3100 KB Partially correct
20 Incorrect 11 ms 3608 KB Wrong Answer [7]
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 4640 KB Output is correct
2 Incorrect 23 ms 4584 KB Output isn't correct
3 Halted 0 ms 0 KB -