Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  6. #define FOR(i,a,b) for(int i = (a); i < (b); i++)
  7. #define rep(i,n) FOR(i,0,n)
  8. #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
  9. #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
  10. #define FILL(a, value) memset(a, value, sizeof(a)
  11.  
  12. #define SZ(a) (int)a.size()
  13. #define ALL(a) a.begin(), a.end()
  14. #define PB emplace_back
  15. #define MP make_pair
  16. #define in insert
  17. #define sc second
  18. #define fs first
  19. #define er erase
  20.  
  21. typedef long long LL;
  22. typedef vector<int> VI;
  23. typedef vector<LL>VL;
  24. typedef vector<bool>VB;
  25. typedef pair<int,int> PII;
  26.  
  27. const double PI = acos(-1.0);
  28. const int INF = 1000 * 1000 * 1000 + 7;
  29. const LL LINF = INF * (LL) INF;
  30.  
  31. const double EPS = 1e-7;
  32. const int MAX = 20 * 1000 + 47;
  33. const int MAS = int(1e6+1);
  34. const int MOD = int(1e9 + 7 );
  35.  
  36.  
  37. int main ()
  38. {
  39. int n;
  40. cin >> n ;
  41. int mx = 0 ,res;
  42. rep(msk,1<<11)
  43. {
  44. bool ok = true;
  45. int cnt = 0;
  46. rep(i,11)
  47. {
  48. if(msk &(1<< i))
  49. {
  50. cnt++ ;
  51. int x = (i+4) %11;
  52. if(msk & (1 << x))ok = false ;
  53. x = (i+7)%11 ;
  54. if(msk &(1 << x))ok = false ;
  55. }
  56. }
  57. if(ok)
  58. {
  59. int ans = (n/11) * cnt ;
  60. rep(i,n%11)
  61. {
  62. if(msk & (1 << i ))
  63. {
  64. ans++;
  65. }
  66. }
  67. if (mx < ans)
  68. {
  69. mx = ans;
  70. res = msk ;
  71. }
  72. }
  73. }
  74. cout << mx << endl ;
  75. rep(i,n)
  76. {
  77. if(res & (1 << (i%11))){
  78. cout << i+1 << " " ;
  79. }
  80. }
  81.  
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement