fork download
  1.  
  2. //|Art|
  3. #include<iostream>
  4. #include <chrono>
  5. //#include <algorithm>
  6. //#include <cmath>
  7. //#include <climits>
  8. //#include <numeric>
  9. //#include <set>
  10. //#include <unordered_set>
  11. //#include <stack>
  12. //#include <string>
  13. //#include <iomanip>
  14. //#include <vector>
  15. //#include <deque>
  16. //#include <queue>
  17. //#include <unordered_map>
  18. #include <map>
  19. //#include <list>
  20. //#include <bits/stdc++.h>
  21. #define inout() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  22. #define el cout << '\n'
  23. #define fi first
  24. #define se second
  25. #define pb push_back
  26. #define pf push_front
  27. #define ll long long
  28. #define st string
  29. #define N 100000
  30. #define sz(x) (x).size()
  31. #define all(v) (v).begin(), (v).end()
  32. #define FOR(a,b,c) for(int a=b;a<=c;++a)
  33. #define FORE(a,b,c) for(int a=b;a>=c;--a)
  34. #define __Art__ signed main()
  35. #define NAME "Art"
  36. using namespace std;
  37. int n, k;
  38. ll m;
  39. void inp (){
  40. cin >> n >> m >> k;
  41. }
  42. /*st binpow (st a, st b, st mod){
  43.  
  44. }*/
  45.  
  46. void sub1(){
  47. map<int, int> mp;
  48. int a[n + 1], res = 0;
  49. res = a[0] = 0;
  50. FOR (i, 1, n) cin >> a[i], a[i] = (a[i - 1] + a[i] % k) % k, res += mp[a[i]], ++mp[a[i]];
  51. FOR (i, 1, n) cout << a[i] << ' ';
  52. cout << res;
  53. }
  54. __Art__{
  55. if (fopen(NAME".INP", "r")) {
  56. freopen(NAME".INP", "r", stdin);
  57. freopen(NAME".OUT", "w", stdout);
  58. }
  59. inout();
  60. inp();
  61. if (m == 1) sub1();
  62. //else if (m <= 1e3) sub2();
  63. // else sub3();
  64.  
  65. cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  66. return (0 ^ 0);
  67. }
  68.  
Success #stdin #stdout #stderr 0.01s 5284KB
stdin
6 1 4
2 1 2 1 4 1
stdout
2 3 1 2 2 3 4
stderr
Time elapsed: 0.007297s