Submission #1005383

# Submission time Handle Problem Language Result Execution time Memory
1005383 2024-06-22T11:44:17 Z aykhn Party (INOI20_party) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define inf 0x3F3F3F3F3F3F3F3F
 
const int MXN = 3e5 + 5;
const int LOG = 60;
const int mod = 1e9 + 7;

int add(int a, int b)
{
  return (a + b + mod) % mod;
}
int mult(int a, int b)
{
  return (a * b) % mod;
}

int p1[10001], p2[100001];
int d[LOG * 2];

int pw(int x)
{
  return mult(p2[(x % (mod - 1)) / 10000], p1[(x % (mod - 1)) % 10000]);
}

int pw(int a, int b, int c)
{
  a %= c;
  int res = 1;
  while (b)
  {
    if (b & 1) res = (res * a) % c;
    a = (a * a) % c;
    b >>= 1;
  }
  return res;
}

int n, res = 0, sz, lay;

void dfs(int a, int l, int r)
{
  int s = 0;
  for (int i = LOG * 2 - 1; i >= 1; i--)
  {
    s = add(s, d[i]);
    res = add(res, add(pw(s), -1));
  }
  if (lay >= l + ((r - l + 1) / 2)) 
  {
    res = add(res, calcsub(2 * i));
  }
  else
  {
    res = (add, res, calcsub(2 * i + 1));
  }
}

void _()
{
  cin >> n;
  for (int i = 0; i < LOG * 2; i++)
  {
    d[i] = max(0LL, min(add(n, -add(pw(i), -1)), pw(i)));
    if (d[i]) lay = d[i], sz = (1LL << i);
  }
  dfs(1, 1, sz);
}

signed main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  p1[0] = 1, p2[0] = 1;
  for (int i = 1; i <= 10000; i++) p1[i] = (p1[i - 1] << 1) % mod;
  for (int i = 1; i <= 100000; i++) p2[i] = (p2[i - 1] * p1[10000]) % mod;
  int t;
  cin >> t;
  while (t--)
  {
    _();
  }
}

Compilation message

Main.cpp: In function 'void dfs(long long int, long long int, long long int)':
Main.cpp:54:32: error: 'i' was not declared in this scope
   54 |     res = add(res, calcsub(2 * i));
      |                                ^
Main.cpp:54:20: error: 'calcsub' was not declared in this scope
   54 |     res = add(res, calcsub(2 * i));
      |                    ^~~~~~~
Main.cpp:58:12: warning: left operand of comma operator is a reference, not call, to function 'add' [-Waddress]
   58 |     res = (add, res, calcsub(2 * i + 1));
      |            ^~~
Main.cpp:58:12: warning: left operand of comma operator has no effect [-Wunused-value]
Main.cpp:58:34: error: 'i' was not declared in this scope
   58 |     res = (add, res, calcsub(2 * i + 1));
      |                                  ^
Main.cpp:58:22: error: 'calcsub' was not declared in this scope
   58 |     res = (add, res, calcsub(2 * i + 1));
      |                      ^~~~~~~