QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#219314#6730. CoolbitsYangmfCompile Error//C++171.8kb2023-10-19 11:58:472023-10-19 11:58:47

Judging History

你现在查看的是最新测评结果

  • [2023-10-19 11:58:47]
  • 评测
  • [2023-10-19 11:58:47]
  • 提交

answer

#include <bits/stdc++.h>
#include <direct.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
#define M(x)          \
    {                 \
        x %= mod;     \
        if (x < 0)    \
            x += mod; \
    }
#define error           \
    {                   \
        cout << "No\n"; \
        return;         \
    }
#define all(x) (x.begin(), x.end())
const int N = 1e6 + 10;
int a[N];
int n, m;
int l[N], r[N];
bool tui[N];
void solve()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {

        cin >> l[i] >> r[i];
        tui[i] = 0;
    }
    int ans = 0;
    int msk = 0;
    for (int i = 29; i >= 0; i--)
    {

        msk += 1 << i;
        int f = 1;
        for (int j = 1; j <= n; j++)
        {

            if (f == 0)
                break;
            if (!(r[j] & (1 << i)))
                f = 0;
        }

        if (f == 1)
        {

            ans += 1 << i;
        }

        for (int j = 1; j <= n; j++)
        {

            if ((msk & r[j]) > ans && ((r[j] & msk) - 1 >= l[j]) && !tui[j])
            {

                r[j] = (r[j] & msk) - 1;
                tui[j] = 1;
            } else if((msk&r[j])>ans&&!tui[j]) {

                r[j]=r[j]-(1<<i);
            }
        }
    }
    cout << ans << "\n";
}
void print(int x)
{

    for (int i = 29; i >= 0; i--)
    {

        cout << ((x >> i) & 1);
    }
    cout << "\n";
}
signed main()
{
    // freopen("D://Desktop//VSCODE//input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    // 29882460 33554431
    // print(29882460);
    // print(93281727);
    while (t--)
    {

        solve();
    }
}

詳細信息

answer.code:2:10: fatal error: direct.h: No such file or directory
    2 | #include <direct.h>
      |          ^~~~~~~~~~
compilation terminated.