Advertisement
vikrant04

KMHAMHA

Oct 14th, 2013
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.50 KB | None | 0 0
  1. using namespace std;
  2. #include <vector>
  3. #include <list>
  4. #include <map>
  5. #include <set>
  6. #include <queue>
  7. #include <deque>
  8. #include <stack>
  9. #include <bitset>
  10. #include <algorithm>
  11. #include <functional>
  12. #include <numeric>
  13. #include <utility>
  14. #include <sstream>
  15. #include <iostream>
  16. #include <fstream>
  17. #include <iomanip>
  18. #include <cstdio>
  19. #include <cmath>
  20. #include <cstdlib>
  21. #include <ctime>
  22. #include <string>
  23. #include <cstring>
  24. #include <climits>
  25.  
  26. #define INF                         (int)1e9
  27. #define EPS                         1e-9
  28.  
  29. #define bitcount                    __builtin_popcount
  30. #define gcd                         __gcd
  31.  
  32. #define s(n)                         scanf("%d",&n)
  33. #define sc(n)                        scanf("%c",&n)
  34. #define sl(n)                        scanf("%lld",&n)
  35. #define sf(n)                        scanf("%lf",&n)
  36. #define ss(n)                        scanf("%s",n)
  37. #define scana(a,t)                   for(int i = 0; i < t; i++){cin >> a[i];}
  38.  
  39. #define FOR(i,a,b)                   for(int i=a;i<b;i++)
  40. #define FOREACH(v, c)                for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
  41. #define REP(i,a)                     for (int i=0; i<a; i++)
  42.  
  43. #define all(a)                        a.begin(), a.end()
  44. #define in(a,b)                       ( (b).find(a) != (b).end())
  45. #define pb                            push_back
  46. #define fill(a,v)                     memset(a, v, sizeof a)
  47. #define sz(a)                         ((int)(a.size()))
  48.  
  49. #define maX(a,b)                      ( (a) > (b) ? (a) : (b))
  50. #define miN(a,b)                      ( (a) < (b) ? (a) : (b))
  51. #define PI                            acos(-1)
  52. #define sqr(x)                        ((x) * (x))
  53.  
  54. #define p(n)                          printf("%d\n",n)
  55. #define pl(n)                         printf("%lld\n",n)
  56. #define pul(n)                        printf("%llu\n", n);
  57. #define pf(n)                         printf("%f\n",n)
  58. #define pc(n)                         printf("%c\n",n)
  59. #define ps(n)                         printf("%s\n",n)
  60.  
  61. #define msort(x)                      sort(all(x))
  62. #define gsort(x)                      sort(all(x), greater<typeof(*((x).begin()))>())
  63. #define mp                            make_pair
  64.  
  65. #define DEBUG(x)                      { cerr << #x << " = " << x << endl; }
  66. #define PR(a,n)                       {cerr<<#a<<" = "; FOR(_,1,n) cerr << a[_] << ' '; cerr <<endl;}
  67. #define PR0(a,n)                      {cerr<<#a<<" = ";REP(_,n) cerr << a[_] << ' '; cerr << endl;}
  68.  
  69. #define numTest(t)                    int t; s(t); while(t--)
  70.  
  71. typedef int64_t LL;
  72. typedef pair<int,int> PII;
  73. typedef pair<LL,LL> PLL;
  74.  
  75. typedef vector<int> VI;
  76. typedef vector<LL> VL;
  77. typedef vector<PII> VII;
  78. typedef vector<PLL> VLL;
  79.  
  80. typedef vector<VI> VVI;
  81. typedef vector<VL> VVL;
  82. typedef vector<VII> VVII;
  83. typedef vector<VLL> VVLL;
  84.  
  85. typedef vector<string> VS;
  86. typedef vector<VS> VVS;
  87.  
  88. int main()
  89. {  
  90.     #ifndef ONLINE_JUDGE
  91.         freopen ("in.txt", "r", stdin);
  92.         // freopen ("out.txt", "w", stdout);
  93.     #endif
  94.     numTest(t)
  95.     {
  96.         int N, M=0;
  97.         cin>>N;
  98.         VII v(N);
  99.  
  100.         FOR(i,0,N)
  101.         {
  102.             int x,y;
  103.             cin>>x>>y;
  104.             v[i] = mp(x,y);
  105.             M = max(M,y);
  106.         }
  107.         msort(v);
  108.         int n = v[N-1].first;
  109.         int k=0;
  110.         FOR(j,0,M+1)
  111.             printf("   %d",j);
  112.         printf("\n");
  113.         FOR(i,0,n+1)
  114.         {
  115.             printf("%d  ",i);
  116.             FOR(j,0,M+1)
  117.             {
  118.                 if (k < N && i== v[k].first && j == v[k].second)
  119.                 {
  120.                     k++;
  121.                     printf("*   ");
  122.                 }
  123.                 else
  124.                     printf("    ");
  125.             }
  126.             printf("\n");
  127.         }
  128.     printf("\n\n");
  129.     }
  130.    
  131.     return 0;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement