Advertisement
Malinovsky239

Untitled

Oct 21st, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <vector>
  5.  
  6. #define pb push_back
  7.  
  8. const int N = 105;
  9.  
  10. using namespace std;
  11.  
  12. int n, m, mx = 0, t[N];
  13. vector<int> au[N], timer[N];
  14.  
  15. int main() {
  16.     freopen("input.txt", "r", stdin);
  17.     freopen("output.txt", "w", stdout);
  18.  
  19.     cin >> n >> m;
  20.     for (int i = 0; i < m; i++) {
  21.         cin >> t[i];
  22.         mx = max(t[i], mx);
  23.     }
  24.    
  25.     cout << mx * n << endl;
  26.  
  27.     for (int i = 0; i < n; i++)
  28.         for (int j = 0; j < m; j++) {
  29.             int num = (i + j) % n;
  30.             au[num].pb(j + 1);
  31.             timer[num].pb(mx * i);
  32.         }
  33.  
  34.     for (int i = 0; i < n; i++) {
  35.         cout << endl;
  36.         for (int j = 0; j < m; j++)
  37.             cout << au[i][j] << " " << timer[i][j] << endl;
  38.     }
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement