fork download
  1. #include <atcoder/modint>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. using namespace atcoder;
  7. using mint = modint998244353;
  8.  
  9. int solve(vector<long long> &a) {
  10. int n = a.size();
  11. long long int noOfOperations = 0;
  12. // dp[i] is the number of black subsets of the first i elements such that
  13. // the i-th element is necessarily painted black.
  14. vector<mint> dp(n), offload(n);
  15. dp[0] = 1;
  16. for (int i = 0; i < n; i++) {
  17. for (int j = i + a[i]; j < n; j += a[i]) {
  18. noOfOperations++;
  19. dp[j] += dp[i] + offload[i];
  20. if (a[j] == a[i]) {
  21. offload[j] += offload[i] + dp[i];
  22. break;
  23. }
  24. }
  25. }
  26.  
  27. mint ans = 0;
  28. for (int i = 0; i < n; i++) {
  29. ans += dp[i];
  30. }
  31. cout<<"No Of Operations: "<<noOfOperations<<endl;
  32. return ans.val();
  33. }
  34.  
  35. int main() {
  36. const int n=200000;
  37. vector<long long> a(n,1);
  38. int R=447;
  39. for(int i=0,nxt=R;i<n;i++){
  40. if(i==nxt){
  41. R-=1;
  42. if(R==0)
  43. break;
  44. nxt=i+R;
  45. }
  46. a[i]=R;
  47. }
  48. cout << solve(a) << endl;
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:10: fatal error: atcoder/modint: No such file or directory
 #include <atcoder/modint>
          ^~~~~~~~~~~~~~~~
compilation terminated.
stdout
Standard output is empty