QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#219247#6730. CoolbitsYangmfCompile Error//C++171.4kb2023-10-19 10:06:562023-10-19 10:06:57

Judging History

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

  • [2023-10-19 10:06:57]
  • 评测
  • [2023-10-19 10:06:56]
  • 提交

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;
            }
        }
    }
    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();
    }
}

Details

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