Created
March 6, 2012 05:46
-
-
Save Wollw/1983889 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 <stdlib.h> | |
#include <stdio.h> | |
int points[100000][2]; | |
int i, j, k; | |
int q; | |
int count[4]; | |
inline void mirror() { | |
i--; | |
q -= 'X'; | |
for (k = i; k < j; k++) | |
points[k][q] = -points[k][q]; | |
} | |
inline void consider() { | |
i--; | |
count[0] = 0; | |
count[1] = 0; | |
count[2] = 0; | |
count[3] = 0; | |
for (k = i; k < j; k++) | |
if (points[k][1] > 0) { | |
if (points[k][0] > 0) | |
count[0]++; | |
else | |
count[3]++; | |
} else if (points[k][1] < 0) { | |
if (points[k][0] > 0) | |
count[1]++; | |
else | |
count[2]++; | |
} | |
printf("%u %u %u %u\n", count[0], count[1], count[2], count[3]); | |
} | |
int main() { | |
int point_count, k; | |
scanf("%d", &point_count); | |
for (k = 0; k < point_count; k++) | |
scanf("%d %d", &points[k][1], &points[k][0]); | |
int query_count; | |
scanf("%d", &query_count); | |
int l; | |
for (l = 0; l < query_count; l++) { | |
scanf("%s %d %d", &q, &i, &j); | |
if (q == 'C' ) { | |
consider(); | |
} else { | |
mirror(); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment