SID1190471/annoying slides are a miracle !!!!!!!!!!!!!!!!!!, Sid1190471 slides
PID221/annoying slides ☆
- Submit your code
- View discussion and question
You have done it before. Check my status and check whether the quality of the last evaluation record can be counted ~ No question rating Quality★★★★★★★★★☆★★★☆☆★★☆☆☆★☆☆☆0% 0% 0% 0% 0%★★★★☆Count 186/337 by Count minimum time consumed 0 MS Minimum Memory 0 kb other question tag type
Others
Description
Professor Li gave a very important speech this afternoon. Unfortunately, he is not a very neat person. He stacked slides for his speech at will. Therefore, he had to organize the slides before the speech. As an efficiency-oriented scholar, he hopes to do it as simply as possible. This is the case. The professor will use n slides (n <= 26) in this speech. The n slides are used in the order of numbers 1, 2 ,..., N is numbered on it. Because slides are transparent, we cannot see the slides corresponding to every number at once.
Now we use uppercase letters A, B, C ,... Compile the slides one by one, as shown in the example. We can quickly find that there are 4th slides numbered as, after extracting it, we can determine that the slides numbered C are 2nd ,...
Your task is to write a program that maps the numbers and letter numbers of the slides. Obviously, this correspondence should be unique; if there are multiple corresponding situations or some numbers and letters do not match, we can say that the correspondence cannot be achieved.
Input Format
The first line has only one number n, indicating that there are n slides. The next n rows contain four integers, Xmin, Xmax, Ymin, and Ymax (separated by spaces ), it is the coordinate of the slide (this area is A slide), and the n slides are numbered A, B, C, and in the order they appear in the input file ,... The next n rows are the coordinates X and Y of n numbers in sequence. Obviously, there are no numbers outside the slides.
(It's actually a keyboard input)
Output Format
If corresponding, your output should include n rows, each row is a letter and a number, separated by a space in the middle, and each row is listed in ascending order of letters, note that the output letters should be capitalized and the top level. Otherwise, if the corresponding character cannot be implemented, output None in the first line of the file. There is no extra space at the end of the first line.
(In fact, the screen output ...)
Sample Input
4
6 22 10 20
4 18 6 16
8 20 2 18
10 24 4 8
9 15
19 17
11 7
21 11
Output
A4
B1
C2
D3
Brute-force miracle brute-force miracle, brute force, miracle, brute force, miracle, Brute Force miracle brute-force miracle brute-force brute-force miracle brute-force miracle, brute force, miracle, brute force, miracle, Brute Force miracle brute-force miracle brute-force brute-force miracle brute-force miracle, brute force, miracle, brute force, miracle, Brute Force miracle brute-force miracle brute-force brute-force miracle brute-force miracle and brute force ,]
1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 using namespace std; 5 struct node 6 { 7 int xmin; 8 int xmax; 9 int ymin;10 int ymax;11 int vis;12 int bj;13 }a[1001];14 struct zb15 {16 int x;17 int y;18 int vis;19 int bj;20 }b[1001];21 int n;22 int flag=0;23 char hh='A';24 int ans[1001];25 void dfs(int p)26 {27 if(p==n+1)28 {29 if(flag==0)30 {31 for(int i=1;i<=n;i++)32 {33 ans[i]=a[i].bj;34 }35 flag=1;36 }37 else 38 {39 for(int i=1;i<=n;i++)40 {41 if(a[i].bj!=ans[i])42 {43 printf("None");44 flag=2;45 return;46 }47 }48 }49 50 /*for(int i=1;i<=n;i++)51 printf("%c %d\n",hh,a[i].bj);52 flag=1;53 return;*/54 }55 for(int j=1;j<=n;j++)56 {57 if(a[j].vis==0)58 {59 for(int k=1;k<=n;k++)60 {61 if(a[j].xmin<b[k].x&&a[j].xmax>b[k].x&&a[j].ymin<b[k].y&&a[j].ymax>b[k].y&&b[k].vis==0)62 {63 a[j].vis=1;64 b[k].vis=1;65 a[j].bj=k;66 dfs(p+1);67 if(flag==2)return; 68 b[k].vis=0;69 a[j].vis=0;70 }71 }72 73 }74 75 }76 }77 int main()78 {79 80 scanf("%d",&n);81 for(int i=1;i<=n;i++)82 scanf("%d%d%d%d",&a[i].xmin,&a[i].xmax,&a[i].ymin,&a[i].ymax);83 for(int i=1;i<=n;i++)84 scanf("%d%d",&b[i].x,&b[i].y);85 dfs(1);86 if(flag==1)87 for(int i=1;i<=n;i++)88 {89 printf("%c%d\n",hh++,ans[i]);90 }91 return 0;92 93 }