Submission #692566

#TimeUsernameProblemLanguageResultExecution timeMemory
692566Ahmed_SolymanFootball (info1cup20_football)C++14
50 / 100
135 ms2072 KiB
#include <bits/stdc++.h> #include <ext/rope> using namespace std; using namespace __gnu_cxx; #pragma GCC optimize("-Ofast") #pragma GCC optimize("-O1") //-------------------------------------------------------------// typedef long long ll; typedef unsigned long long ull; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define PI acos(-1) #define lb lower_bound #define ub upper_bound #define endl '\n' #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define sum_to(n) (n*(n+1))/2 #define pb push_back #define pf push_front #define sz size() #define fil(arr,x) memset(arr,x,sizeof(arr)) const ll mod=1e9+7; int dx[8]={0,1,0,-1,1,1,-1,-1}; int dy[8]={1,0,-1,0,1,-1,-1,1}; //-------------------------------------------------------------// ll lcm(ll a,ll b) { return (max(a,b)/__gcd(a,b))*min(a,b); } void person_bool(bool x) { cout<<(x?"YES":"NO")<<endl; } int n,k; int dp[105][105]; int solve(int i,int lst){ int &ret=dp[i][lst]; if(~ret){ return ret; } ret=0; for(int j=1;j<=lst;j++){ if(j>=i){ ret=1;break; } ret|=(solve(i-j,j)==0); } return ret; } int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); fast ll t=1; cin>>t; while(t--){ fil(dp,-1); cin>>n>>k; vector<int>arr(n); int s=0; for(auto &i:arr)cin>>i,s+=i; if(k==1 || s&1){ cout<<(s&1); continue; } int block=0; int cnt=0; for(int i=0;i<=29;i++){ cnt+=(1<<i); if(k<=cnt){ block=i; break; } } cout<<(s%(1<<(block+1))>0); } return 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...