Submission #456141

# Submission time Handle Problem Language Result Execution time Memory
456141 2021-08-06T07:11:07 Z MOUF_MAHMALAT ČVENK (COI15_cvenk) C++14
17 / 100
1 ms 332 KB
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
using namespace std;
typedef long long ll;
ll n,x,y,xx,yy,ans,o;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>x>>y>>xx>>yy;
    for(ll i=(1<<30); i; i>>=1)
    {
        if((i&x)==(i&xx)&&(i&y)==(i&yy))
            continue;
        if((i&x)&&(i&xx)==0)
        {
            o=0;
            for(ll j=i; j; j>>=1)
            {
                o|=(j&x);
                if((j&y))
                {
                    ans+=j;
                    y^=j;
                }
            }
            ans+=o-i+1;
            x^=i,x|=(i-1);
        }
        if((i&x)==0&&(i&xx))
        {
            o=0;
            for(ll j=i; j; j>>=1)
            {
                o|=(j&xx);
                if((j&yy))
                {
                    ans+=j;
                    yy^=j;
                }
            }
            ans+=o-i+1;
            xx^=i,xx|=(i-1);
        }
        if((i&y)&&(i&yy)==0)
        {
            o=0;
            for(ll j=i; j; j>>=1)
            {
                o|=(j&y);
                if((j&x))
                {
                    ans+=j;
                    x^=j;
                }
            }
            ans+=o-i+1;
            y^=i,y|=(i-1);
        }
        if((i&y)==0&&(i&yy))
        {
            o=0;
            for(ll j=i; j; j>>=1)
            {
                o|=(j&yy);
                if((j&xx))
                {
                    ans+=j;
                    xx^=j;
                }
            }
            ans+=o-i+1;
            yy^=i,yy|=(i-1);
        }
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -