Submission #364976

#TimeUsernameProblemLanguageResultExecution timeMemory
364976Matteo_VerzFootball (info1cup20_football)C++17
0 / 100
1 ms364 KiB
/* `-/oo+/- `` .oyhhhhhhyo.`od +hhhhyyoooos. h/ +hhyso++oosy- /s .yoooossyyo:``-y` ..----.` ``.-/+:.` `````..-::/. `..```.-::///` `-.....--::::/: `.......--::////: `...`....---:::://: `......``..--:::::///:` `---.......--:::::////+/` ----------::::::/::///++: ----:---:::::///////////:` .----::::::////////////:-` `----::::::::::/::::::::- `.-----:::::::::::::::- ...----:::::::::/:-` `.---::/+osss+:` ``.:://///-. */ #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <stack> #include <queue> #include <bitset> #include <random> #include <deque> #include <set> #include <map> #include <cmath> #define debug(x) cerr << #x << " " << x << '\n' #define debugsp(x) cerr << #x << " " << x << ' ' using namespace std; const int INF = 2e9; const int N = 1e5; int v[1 + N]; int answer; void Solve(int n, int k) { int s(0); for(int i = 1; i <= n; i++) s ^= (v[i] & 1); if(k == 1) { answer = s; return; } if(s & 1) { answer = 1; return; } for(int i = 1; i <= n; i++) v[i] >>= 1; Solve(n, k >> 1); } int main() { freopen("football2.in", "r", stdin); freopen("football2.out", "w", stdout); int t; scanf("%d", &t); while(t--) { int n, k; scanf("%d%d", &n, &k); for(int i = 1; i <= n; i++) scanf("%d", &v[i]); Solve(n, k); printf("%d", answer); answer = 0; } return 0; }

Compilation message (stderr)

football.cpp: In function 'int main()':
football.cpp:67:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   67 |   freopen("football2.in", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
football.cpp:68:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   68 |   freopen("football2.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
football.cpp:70:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   70 |   scanf("%d", &t);
      |   ~~~~~^~~~~~~~~~
football.cpp:74:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   74 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
football.cpp:75:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   75 |     for(int i = 1; i <= n; i++) scanf("%d", &v[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...