Submission #523877

#TimeUsernameProblemLanguageResultExecution timeMemory
523877iskhakkutbilimFootball (info1cup20_football)C++14
26 / 100
29 ms940 KiB
// Author: Tazhibaev Iskhak
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int, int> ,null_type,less< pair<int, int> >,rb_tree_tag,
	tree_order_statistics_node_update> ordered_set;
const long double pi = acos((long double) - 1.0);
const double eps = (double)1e-9;
const int INF = 1e9 + 7;
    #define ff         first
    #define ss         second
    #define int         long long
    #define ld		   long double
    #define pb         push_back
void usaco( string filename){
  freopen((filename+".in").c_str(), "r", stdin);
  freopen((filename+".out").c_str(), "w", stdout);
}

void solve(){
	int n, k; cin >> n >> k;
	vector<int> a(n);
	int all = 0LL;
	for(int i = 0;i < n; i++){
		cin >> a[i];
		all+= a[i];
	}
	if(k == 1LL){
		if(all % 2LL == 1LL) cout << 1;
		else cout << 0;
	}else cout << 1;
}

main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(nullptr); cout.tie(nullptr);
	 //usaco();
     int T = 1;
     cin >> T;
     while(T--){
     	solve();
     }
    return 0;
}

Compilation message (stderr)

football.cpp:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main(){
      | ^~~~
football.cpp: In function 'void usaco(std::string)':
football.cpp:20:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   freopen((filename+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
football.cpp:21:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   freopen((filename+".out").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...