Submission #932794

#TimeUsernameProblemLanguageResultExecution timeMemory
932794Captain_GeorgiaFootball (info1cup20_football)C++17
0 / 100
2063 ms3688 KiB
#include <bits/stdc++.h> using namespace std; /// toto -> 1 #define pb push_back #define pii pair<int,int> #define pll pair<ll,ll> #define io \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define all(a) a.begin(),a.end() #define rep(k,i,n) for(int k=i;k<n;k++) #define repp(k,i,n) for(int k=n-1;k>=i;k--) #define rech(k) for(char k='a';k<='z';k++) #define SZ(a) (int)a.size() #define MX(a) *max_element(all(a)) #define MN(a) *min_element(all(a)) #define SM(a) accumulate(all(a),0LL) #define vi vector<int> #define vl vector<long long> #define vvl vector<vector<long long>> #define vvi vector<vector<int>> #define fii first #define see second template <typename T> inline bool umin(T &a, const T &b) { if(a > b) { a = b; return 1; } return 0; } template <typename T> inline bool umax(T &a, const T &b) { if(a < b) { a = b; return 1; } return 0; } /// toto -> long long mod = 1e9 + 7 , modd = 998244353; typedef long long ll; void F1(bool res) { if(res) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void open (string s, string f) { freopen((s + ".txt").c_str(), "r", stdin); freopen((f + ".txt").c_str(), "w", stdout); } void openn (string s, string f) { freopen(s.c_str(), "r", stdin); freopen(f.c_str(), "w", stdout); } struct mint{ ll val; mint(int64_t v = 0) { v %= mod; if (v < 0) v += mod; val = v; } mint& operator+=(const mint& other) { val += other.val; if (val >= mod) val -= mod; return *this; } mint& operator-=(const mint& other) { val += mod - other.val; if (val >= mod) val -= mod; return *this; } mint& operator*=(const mint& other) { val = (int64_t)val * other.val % mod; return *this; } mint& operator/=(const mint& other) { return *this *= other.inv(); } friend mint operator+(mint a, const mint& b) { return a += b; } friend mint operator-(mint a, const mint& b) { return a -= b; } friend mint operator*(mint a, const mint& b) { return a *= b; } friend mint operator/(mint a, const mint& b) { return a /= b; } mint pow(int64_t exp) const { mint a = *this, res = 1; while (exp > 0) { if (exp & 1) res *= a; a *= a; exp >>= 1; } return res; } mint inv() const { assert(val != 0); return pow(mod - 2); } friend ostream& operator<<(ostream& os, const mint& m) { return os << m.val; } }; ll bp(ll n,ll m){ if(m == 0){ return 1; } if(m == 1){ return n%mod; } if(m%2==0){ return bp(n*n%mod,m/2)%mod; } return n*bp(n,m-1)%mod; } /// toto -> 3 const int N = 3e5 + 2, M = 1e6 + 434, inf = 1e9 + 1; const ll inff = 1e18; void solve(){ int n , k; cin >> n >> k; vi a(n); rep (i,0,n) { cin >> a[i]; } rep (bit,0,30) { if ((1 << bit) > k) { continue; } vi v = a; int ind = 0 , x = bit; rep (i,0,n) { while (v[i] > 0) { if (v[i] >= (1 << x)) { v[i] -= (1 << x); } else { while (v[i] < (1 << x)) { x --; } v[i] -= (1 << x); } ind = (1 - ind); } if (ind == 0) { cout << "1"; return; } } } cout << "0"; } int32_t main () { io; ll t = 1; cin >> t; rep (_,1,t+1) { cerr << "Start of test case " << _ << "\n"; ///cout<<"Case #"<<_<<": "; solve(); cerr << "\n"; cerr << "\n"; } return 0; }

Compilation message (stderr)

football.cpp: In function 'void open(std::string, std::string)':
football.cpp:49:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     freopen((s + ".txt").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
football.cpp:50:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |     freopen((f + ".txt").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
football.cpp: In function 'void openn(std::string, std::string)':
football.cpp:54:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |     freopen(s.c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
football.cpp:55:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |     freopen(f.c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...