Submission #1089954

# Submission time Handle Problem Language Result Execution time Memory
1089954 2024-09-17T12:26:15 Z solitaryMan Room Temperature (JOI24_ho_t1) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define ll long long
#define line cout << "---------------------------" << endl;
#define M -1
#define debug(x) cout << "x " << x << endl;
#define all(a) a.begin(), a.end()
#define INF (int) 1e9


bool sq(int n){
	return n * n;
}
void solve(){
	int n,t; cin >> n >> t;
	if(t == 1){
		cout << 0 << endl;
		return;
	}	
	vector<int> v(n);
	bool flg = 0;
	for(int i = 0; i < n; i++){
		cin >> v[i];
		cnt += v[i] % 2 ;
	}
	cout << (cnt == n or cnt == 0 ? 0 : 1);
// 2
// 1 2 3 4 5
// 1 2 1 2 1
// 1 0 1 0 1
}
int32_t main(){
	int t = 1;
	//cin >> t;
	while(t--){solve();}
	    cerr << "Execution time: " << 1000.f * clock() / CLOCKS_PER_SEC << " ms." << endl;

}

Compilation message

Main.cpp: In function 'bool sq(int)':
Main.cpp:14:11: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   14 |  return n * n;
      |         ~~^~~
Main.cpp: In function 'void solve()':
Main.cpp:26:3: error: 'cnt' was not declared in this scope; did you mean 'int'?
   26 |   cnt += v[i] % 2 ;
      |   ^~~
      |   int
Main.cpp:28:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   28 |  cout << (cnt == n or cnt == 0 ? 0 : 1);
      |           ^~~
      |           int
Main.cpp:23:7: warning: unused variable 'flg' [-Wunused-variable]
   23 |  bool flg = 0;
      |       ^~~