Submission #679985

#TimeUsernameProblemLanguageResultExecution timeMemory
679985BeveritaFootball (info1cup20_football)C++17
26 / 100
209 ms468 KiB
#include <bits/stdc++.h> using namespace std; unsigned long long TestCases, n, k, sum; vector<int> v; bool ok; void read() { sum = 0; v.clear(); cin >> n >> k; for (int i = 0; i < n; ++i) { int x; cin >> x; sum += x; if (x != 1)v.push_back(x); } } bool Sum() { unsigned long long val = 0; for (int i = 0; i < v.size(); ++i) { v[i] /= 2; val += v[i]; } if (val % 2 == 0)return true; return false; } void solve() { while (Sum() && k > 1) { ok = (1 - ok); k /= 2; } } int main() { cin >> TestCases; while (TestCases--) { read(); if (sum % 2 == 1) { cout << 1 ; continue; } else if (k == 1) { cout << 0; continue; } solve(); cout << 1 - ok; } return 0; }

Compilation message (stderr)

football.cpp: In function 'void read()':
football.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   13 |     for (int i = 0; i < n; ++i) {
      |                     ~~^~~
football.cpp: In function 'bool Sum()':
football.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < v.size(); ++i) {
      |                     ~~^~~~~~~~~~
#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...