Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <algorithm>
- #include <map>
- #include <vector>
- #include <ctype.h>
- #include <set>
- using namespace std;
- int main()
- {
- int a[101] = {0};
- int b[101] = {0};
- int c[3][101];
- int n;
- int i,j,k;
- scanf("%d",&n);
- int q;
- q = (n+1)/2;
- for(i=1;i<=q;++i)
- {
- for(j=1;j<=n;++j)
- {
- c[1][j] = c[2][j];
- c[2][j] = 0;
- }
- printf("Q %d %d",i,i+q-1);
- fflush(stdout);
- for(j=1;j<=q;++j)
- {
- scanf("%d",&k);
- b[k]++;
- c[2][k] = 1;
- }
- if(i!=1)
- {
- for(j=1;j<=n;++j)
- if(c[1][j] == 1 && c[2][j] == 0)
- a[i-1] = j;
- else if(c[1][j] == 0 && c[2][j] == 1)
- a[i+q-1] = j;
- }
- if(i == q)
- {
- for(j=1;j<=n;++j)
- if(b[j] == q)
- a[q] = j;
- else if(b[j] == 0)
- a[n] = j;
- }
- }
- printf("A ");
- fflush(stdout);
- for(i=1;i<=n;++i)
- {
- printf("%d ",a[i]);
- fflush(stdout);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement