Submission #311838

# Submission time Handle Problem Language Result Execution time Memory
311838 2020-10-11T22:33:17 Z VROOM_VARUN City (JOI17_city) C++14
Compilation error
0 ms 0 KB
/*
ID: varunra2
LANG: C++
TASK: encoder
*/

#include <bits/stdc++.h>
#include "Encoder.h"
using namespace std;

#ifdef DEBUG
#include "lib/debug.h"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define debug_arr(...) \
  cerr << "[" << #__VA_ARGS__ << "]:", debug_arr(__VA_ARGS__)
#pragma GCC diagnostic ignored "-Wsign-compare"
//#pragma GCC diagnostic ignored "-Wunused-parameter"
//#pragma GCC diagnostic ignored "-Wunused-variable"
#else
#define debug(...) 42
#endif

#define EPS 1e-9
#define IN(A, B, C) assert(B <= A && A <= C)
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define x first
#define y second

const double PI = acos(-1.0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef map<int, int> MPII;
typedef multiset<int> MSETI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<string> VS;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
#pragma GCC diagnostic ignored "-Wsign-compare"
// util functions

int n;
VVI adj;
VI tin;
VI tout;
int tim = -1;

// void Code(int city, long long code) { debug(city, code); }

void dfs(int u, int v) {
  tin[u] = ++tim;
  for (auto& x : adj[u]) {
    if (x == v) continue;
    dfs(x, u);
  }
  tout[u] = tim;
}

const int mult = (int)(1 << 18);

ll create(int l, int r) { return l * mult + r; }

void Encode(int N, int a[], int b[]) {
  n = N;
  adj.resize(n);
  tin.resize(n);
  tout.resize(n);
  for (int i = 0; i < n - 1; i++) {
    adj[a[i]].PB(b[i]);
    adj[b[i]].PB(a[i]);
  }

  dfs(0, -1);

  for (int i = 0; i < n; i++) {
    Code(i, create(tin[i], tout[i]));
  }
}

// int main() {
// #ifndef ONLINE_JUDGE
//   freopen("encoder.in", "r", stdin);
//   freopen("encoder.out", "w", stdout);
// #endif
//   cin.sync_with_stdio(0);
//   cin.tie(0);

//   int n;

//   cin >> n;

//   int a[n - 1];
//   int b[n - 1];

//   for (int i = 0; i < n - 1; i++) {
//     cin >> a[i] >> b[i];
//   }

//   Encode(n, a, b);

//   return 0;
// }
/*
ID: varunra2
LANG: C++
TASK: device
*/

#include<bits/stdc++.h>
#include "Device.h"
using namespace std;

#ifdef DEBUG
#include "lib/debug.h"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define debug_arr(...) \
  cerr << "[" << #__VA_ARGS__ << "]:", debug_arr(__VA_ARGS__)
#pragma GCC diagnostic ignored "-Wsign-compare"
//#pragma GCC diagnostic ignored "-Wunused-parameter"
//#pragma GCC diagnostic ignored "-Wunused-variable"
#else
#define debug(...) 42
#endif

#define EPS 1e-9
#define IN(A, B, C) assert(B <= A && A <= C)
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define x first
#define y second

const double PI = acos(-1.0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef map<int, int> MPII;
typedef multiset<int> MSETI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<string> VS;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
#pragma GCC diagnostic ignored "-Wsign-compare"
// util functions

const int mult = (int)(1 << 18);

void initDevice() {
  return;
}

PII decode(ll x) {
  return MP(x/mult, x%mult);
}

int Answer(ll S, ll T) {
  PII u = decode(S);
  PII v = decode(T);
  if(u.x <= v.x and u.y >= v.y) return 1;
  if(u.x >= v.x and u.y <= v.y) return 0;
  return 2;
}

// int main() {
// #ifndef ONLINE_JUDGE
//   freopen("device.in", "r", stdin);
//   freopen("device.out", "w", stdout);
// #endif
//   cin.sync_with_stdio(0); cin.tie(0);

//   return 0;
// }

Compilation message

/tmp/ccGCm9aZ.o: In function `main':
grader_device.cpp:(.text.startup+0xe7): undefined reference to `InitDevice()'
collect2: error: ld returned 1 exit status