-
-
Save anurudhp/21268c833a74fd2bbc3ee0a9eb6858b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
using VI = vector<int>; | |
using PII = pair<int, int>; | |
using ull = unsigned long long; | |
#define trace(v) cerr << ">> " << #v << " = " << v << "\n" | |
int N; | |
void test_vector() { | |
cerr << "TESTING VECTOR\n"; | |
VI init = {0, 0}; | |
vector<VI> v(N, init); | |
int *p1 = &(v[0][0]); | |
int *p2 = &(v[1][0]); | |
int *p3 = &(v[2][0]); | |
trace((p2 - p1)); | |
trace((p3 - p2)); | |
} | |
void test_pair() { | |
cerr << "TESTING PAIR\n"; | |
PII init = {0, 0}; | |
vector<PII> v(N, init); | |
int *p1 = &(v[0].first); | |
int *p2 = &(v[1].first); | |
int *p3 = &(v[2].first); | |
trace((p2 - p1)); | |
trace((p3 - p2)); | |
} | |
int main() { | |
cin >> N; | |
test_vector(); | |
test_pair(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment