Guest User

GCJ p2

a guest
May 18th, 2019
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int TC; cin>>TC;
  7. for(int tc = 1; tc <= TC; tc++){
  8. //first 80 days put in from 1 to 16
  9. //then inspect the 4 from 17 to 20. find the min
  10. //put in all the others for the rest of the day
  11. vector<int> perm(20);
  12. for(int i = 0; i < 20; i++) perm[i] = i+1;
  13. random_shuffle(perm.begin(), perm.end());
  14. int pntr = 0;
  15. for(int d = 1; d <= 80; d++){
  16. int dayno; cin>>dayno;
  17. assert(d == dayno);
  18. cout<<(perm[pntr])<<" "<<1<<endl;
  19. pntr = (pntr + 1)%15;
  20. }
  21. int best = 1000, indx = -1;
  22. for(int j = 16; j <= 20; j++){
  23. int dayno; cin>>dayno;
  24. cout<<perm[j-1]<<" "<<0<<endl;
  25. int sz; cin>>sz;
  26. for(int k = 0; k < sz; k++){
  27. int temp; cin>>temp;
  28. }
  29.  
  30. if(best >= sz){
  31. best = sz; indx = j;
  32. }
  33. }
  34. pntr = 0;
  35. vector<int> order = {16, 17, 18, 19, 20};
  36. order.erase(indx-16+order.begin());
  37. for(int d = 86; d <= 99; d++){
  38. int dayno; cin>>dayno;
  39. assert(dayno == d);
  40. cout<<(perm[order[pntr]-1])<<" "<<1<<endl;
  41. pntr = (pntr + 1)%order.size();
  42. }
  43. int temp2; cin>>temp2;
  44. cout<<perm[indx-1]<<" "<<100<<endl;
  45. }
  46. }
Add Comment
Please, Sign In to add comment