Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <vector>
- #include <set>
- #include <bitset>
- #include <map>
- #include <deque>
- #include <string>
- #include <algorithm>
- #include <numeric>
- #include <cstdio>
- #include <cassert>
- #include <cstdlib>
- #include <cstring>
- #include <ctime>
- #include <cmath>
- #define pb push_back
- #define pbk pop_back
- #define mp make_pair
- #define fs first
- #define sc second
- #define all(x) (x).begin(), (x).end()
- #define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
- #define len(a) ((int) (a).size())
- #ifdef CUTEBMAING
- #define eprintf(...) fprintf(stderr, __VA_ARGS__)
- #else
- #define eprintf(...) 42
- #endif
- using namespace std;
- typedef long long int64;
- typedef long double ld;
- typedef unsigned long long lint;
- const int inf = (1 << 30) - 1;
- const int64 linf = (1ll << 62) - 1;
- const int C = 1000;
- int main() {
- int n; cin >> n;
- vector<pair<pair<int, int>, int>> points(n);
- for (int i = 0; i < n; i++) {
- scanf("%d%d", &points[i].fs.fs, &points[i].fs.sc);
- points[i].sc = i;
- points[i].fs.fs /= C;
- }
- sort(all(points), [](const pair<pair<int, int>, int> &a, const pair<pair<int, int>, int> &b) {
- return a.fs.fs < b.fs.fs || (a.fs.fs == b.fs.fs && (a.fs.fs % 2 == 0 ? (a.fs.sc < b.fs.sc) : (a.fs.sc > b.fs.sc)));
- });
- for (auto i : points) {
- printf("%d ", i.sc + 1);
- }
- puts("");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement