Submission #910163

#TimeUsernameProblemLanguageResultExecution timeMemory
910163MaaxleAmusement Park (JOI17_amusement_park)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "Joi.h" #define ll long long #define range(i, a, b) for (ll i = a; i < b; i++) #define all(x) begin(x), end(x) #define INF ((ll) 1 << 60) #define pqueue priority_queue using namespace std; ll x; vector<vector<ll>> adj; vector<bool> memo; void dfs (ll i, ll dig) { memo[i] = 1; MessageBoard(i, (int) ((x & (1ll << dig)) > 0)); for (ll k : adj[i]) { if (!memo[k]) dfs(k, (dig + 1) % 60); } } void Joi(int N, int M, int A[], int B[], long long X, int T) { adj.resize(N); memo.resize(N); x = X; range(i, 0, M) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } dfs(0, 0); }
#include <bits/stdc++.h> #include "Ioi.h" #define ll long long #define range(i, a, b) for (ll i = a; i < b; i++) #define all(x) begin(x), end(x) #define INF ((ll) 1 << 60) #define pqueue priority_queue using namespace std; struct TPos { ll node, dig; }; bool operator < (const TPos& i, const TPos& j) { return i.node < j.node; } ll v; ll v_it = -1; vector<vector<ll>> adj; vector<bool> memo; vector<ll> path; vector<TPos> pre; void dfs (ll i, ll dig) { memo[i] = 1; path.push_back(i); if (i == v && v_it == -1) v_it = path.size() - 1; if (pre.empty()) pre.push_back({i, 0}); else pre.push_back({i, pre[pre.size() - 2].dig + 1}); for (ll k : adj[i]) { if (!memo[k]) dfs(k, (dig + 1) % 60); } if (path.back() != i) path.push_back(i); } long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) { adj.resize(n); memo.resize(n); v = V; range(i, 0, M) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } dfs(0, 0); for (TPos& it : pre) it.dig %= 60; sort(all(pre)); vector<ll> freq (60); ll l = v_it, r = v_it; freq[pre[v_it].dig]++; ll cnt = 1; while (r < path.size() - 1 && r - v + 1 < 120) { r++; freq[pre[r].dig]++; if (freq[pre[r].dig] == 1) cnt++; } while (l > 0 && r - l + 1 < 120) { l--; freq[pre[l].dig]++; if (freq[pre[l].dig] == 1) cnt++; } while (cnt < 60) { l--; freq[pre[l].dig]++; if (freq[pre[l].dig] == 1) cnt++; freq[pre[r].dig]--; if (freq[pre[r].dig] == 0) cnt--; r--; } ll ans = 0; range(i, v_it, r + 1) { if (path[i] == v) { ans |= ((ll) P << pre[path[i]].dig); continue; } ans |= (Move(path[i]) << pre[path[i]].dig); } for (ll i = r - 1; i >= r; i++) { if (path[i] == v) { ans |= ((ll) P << pre[path[i]].dig); continue; } ans |= (Move(path[i]) << pre[path[i]].dig); } return ans; }

Compilation message (stderr)

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:46:13: error: 'n' was not declared in this scope
   46 |  adj.resize(n);
      |             ^
Ioi.cpp:64:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |  while (r < path.size() - 1 && r - v + 1 < 120) {
      |         ~~^~~~~~~~~~~~~~~~~