/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Wrong Answer 1ms 540.0 KiB
#4 Wrong Answer 3ms 796.0 KiB
#5 Wrong Answer 1ms 540.0 KiB
#6 Wrong Answer 3ms 1.027 MiB
#7 Wrong Answer 2ms 796.0 KiB
#8 Wrong Answer 5ms 796.0 KiB
#9 Wrong Answer 7ms 1.258 MiB
#10 Wrong Answer 7ms 1.277 MiB
#11 Wrong Answer 3ms 1.027 MiB
#12 Wrong Answer 2ms 796.0 KiB
#13 Wrong Answer 4ms 1.277 MiB
#14 Wrong Answer 4ms 1.277 MiB
#15 Wrong Answer 4ms 1.277 MiB
#16 Wrong Answer 4ms 1.277 MiB
#17 Wrong Answer 4ms 1.277 MiB
#18 Wrong Answer 8ms 1.277 MiB
#19 Wrong Answer 4ms 1.574 MiB
#20 Wrong Answer 4ms 1.277 MiB
#21 Wrong Answer 13ms 1.188 MiB
#22 Wrong Answer 3ms 1.027 MiB
#23 Wrong Answer 4ms 1.277 MiB
#24 Wrong Answer 4ms 1.32 MiB
#25 Wrong Answer 4ms 1.277 MiB
#26 Wrong Answer 1ms 540.0 KiB
#27 Wrong Answer 1ms 540.0 KiB

Code

// بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
// In the Name of Allah, the Beneficent, the Merciful.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define vi vector<int>
#define vl vector<long long>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define inv(a) for(auto &it : a) cin >> it;
#define outv(a) for(auto &it : a) cout << it << " ";cout<<"\n"
#define outv1(a) for(auto &it : a) cout << it << " "<<"\n";cout<<"\n"
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define inf 1e9
// #define double long double
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
 
void solve(int tc) {
    int n,k;
    cin>>n>>k;
    vl v(n);
    inv(v);
    int ans = 0;
    for (int i = 0; i <= 41; i++)
    {
        int sum=0,x=(1LL<<i);
        if(x>k) break;

        for (int j = 0; j < n; j++)
        {
            sum += (v[j]^x);
        }
        ans = max(ans, sum);
    }
    cout<<ans<<endl;
}

int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    fastio;
    int tc=1;
    // cin>>tc;
    for (int i = 1; i <= tc; i++)
    {
        solve(i);
    }
    
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1054 Yet another challenge for Roy!
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-08 10:51:13
Judged At
2024-05-08 10:51:13
Judged By
Score
2
Total Time
13ms
Peak Memory
1.574 MiB