Submission #509956

#TimeUsernameProblemLanguageResultExecution timeMemory
509956omohamadoooFootball (info1cup20_football)C++14
0 / 100
41 ms16300 KiB
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll >
#define F first
#define S second
#define double long double
#define all(x) (x).begin(),(x).end()

using namespace std;
using namespace __gnu_pbds;

typedef tree<ll , null_type , less<ll> ,rb_tree_tag ,tree_order_statistics_node_update >ordered_set;

const int MOD=1e9+7 ;
const int  N=1e6+7;
const ll INF= 1e18+10;

long long po(ll x,ll y)
{
    ll ans=1;

    while(y){
        if(y&1)
        ans*=x;
        y/=2;
        x*=x;
        //ans%=MOD;
        //x%=MOD;

    }
    return ans;
}

ll n;
ll k;
ll a[N];
ll ctr[40];

void solve()
{
    ll ctr2 = 0,ctr4 = 0;
    cin>>n>>k;
    ll  sm = 0;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
        sm  += a[i];
        for(ll j= 2,w = 1;j<=a[i] ;j++,w++){
            ctr[w] += a[i] / j;
        }
    }
    if(sm & 1){
        cout<<1;
        return;
    }
    for(ll i= 1;i<=33;i++){
        if((1LL << i) > k) break;
        if(ctr[i] &1){
            cout<<1;
            return;
        }
    }
    cout<<0;
    return;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt" , "r" , stdin);freopen("output.txt" , "w" , stdout);
	int t = 1;
    cin >> t;
	while(t--) {solve() ; for(ll i=1;i<39;i++) ctr[i] = 0;}
}

Compilation message (stderr)

football.cpp: In function 'void solve()':
football.cpp:45:8: warning: unused variable 'ctr2' [-Wunused-variable]
   45 |     ll ctr2 = 0,ctr4 = 0;
      |        ^~~~
football.cpp:45:17: warning: unused variable 'ctr4' [-Wunused-variable]
   45 |     ll ctr2 = 0,ctr4 = 0;
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...