Individual NO. 1
An error occurred while understanding the question at the beginning.
A star has N stars at the bottom left, and its level is N.
At first, we understood that both X and Y must be less than the two coordinates. Then, we can see from the example that we only need the lower left corner. The X and Y coordinates must be less than or equal to, but not the stars themselves.
# Include <iostream> # include <stdio. h> # include <string. h> using namespace std; int lowbit (int x) {return x &-x;} int c [32005]; int x [32005]; int n; int ans [32005]; int visit [32005]; int a [32005]; void add (int x, int y) // all subsequent values are worth updating, excluding itself {while (x <= 32005) {c [x] + = y; x + = lowbit (x) ;}} int sum (int x) {int ret = 0; while (x> 0) {ret + = c [x]; x-= lowbit (x);} return ret;} int main () {while (scanf ("% d", & n )! = EOF) {memset (c, 0, sizeof (c); memset (x, 0, sizeof (x); memset (ans, 0, sizeof (ans )); int x, y; for (int I = 1; I <= n; I ++) {scanf ("% d", & a [I], & y); if (visit [a [I] + 1] = 0) {add (a [I] + 2, 1 ); visit [a [I] + 1] = 1;} else add (a [I] + 1, 1 ); // c [I] indicates the number of ans [sum (a [I] + 1)] ++;} for (int I = 0; I <n; I ++) printf ("% d \ n", ans [I]);} return 0 ;}# include <iostream >#include <stdio. h> # include <string. h> using namespace std; int lowbit (int X) {return x &-x;} int c [32005]; int x [32005]; int n; int ans [32005]; int visit [32005]; int a [32005]; void add (int x, int y) // all subsequent values are worth updating, excluding itself {while (x <= 32005) {c [x] + = y; x + = lowbit (x) ;}} int sum (int x) {int ret = 0; while (x> 0) {ret + = c [x]; x-= lowbit (x);} return ret;} int main () {while (scanf ("% d", & n )! = EOF) {memset (c, 0, sizeof (c); memset (x, 0, sizeof (x); memset (ans, 0, sizeof (ans )); int x, y; for (int I = 1; I <= n; I ++) {scanf ("% d", & a [I], & y); if (visit [a [I] + 1] = 0) {add (a [I] + 2, 1 ); visit [a [I] + 1] = 1;} else add (a [I] + 1, 1 ); // c [I] indicates the number of ans [sum (a [I] + 1)] ++;} for (int I = 0; I <n; I ++) printf ("% d \ n", ans [I]);} return 0 ;}