Submission #901693

# Submission time Handle Problem Language Result Execution time Memory
901693 2024-01-10T00:30:26 Z trMatherz Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
//#include <iostream> //cin, cout
#include "secret.h"
/*
#include <fstream>
std::ifstream cin ("ex.in");
std::ofstream cout ("ex.out");
*/




// includes
#include <cmath> 
#include <set>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <unordered_set>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>
#include <chrono>



//usings 
using namespace std;
using namespace __gnu_pbds;


// misc
#define ll long long
#define pb push_back
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
template<typename T, typename U> bool emin(T &a, const U &b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool emax(T &a, const U &b){ return b > a ? a = b, true : false; }
typedef uint64_t hash_t;

// vectors
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vpii vector<pair<int, int>>
#define vvpii vector<vector<pair<int, int>>>
#define vppipi vector<pair<int, pair<int, int>>>
#define vl vector<ll>
#define vvl vector<vl>
#define vvvl vector<vvl>
#define vpll vector<pair<ll, ll>>
#define vb vector<bool>
#define vvb vector<vb>
#define vs vector<string>
#define sz(x) (int)x.size()
#define rz resize
#define all(x) x.begin(), x.end()


// pairs
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define f first
#define s second

// sets
#define si set<int>
#define sl set<ll>
#define ss set<string>
#define in insert
template <class T> using iset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// maps
#define mii map<int, int>
#define mll map<ll, ll>

// loops
#define FR(x, z, y) for (int x = z; x < y; x++)
#define FRe(x, z, y) FR(x, z, y + 1)
#define F(x, y) FR(x, 0, y)
#define Fe(x, y) F(x, y + 1)
#define A(x, y) for(auto &x : y)


int n;
vvi v;

void build(int l, int r){
	if(l == r) return v[l][l];
	int m = (l + r) / 2;
	v[l][r] = Secret(build(l, m), build(m + 1, r));
	return v[l][r];
}
int get(int l, int r, int rl, int rr){
	if(r < rl || l > rr) return -1;
	if(rl <= l && r <= rr) return v[l][r];
	int m = (l + r) / 2;
	int x = get(l, m, rl, rr);
	int y = get(m + 1, r, rl, rr);
	if(x == -1) return y; if(y == -1) return x;
	return Secret(x, y);
}
void Init(int N, int A[]){
	cin >> N: n = N;
	v = vvi(n, vi(n));
	F(i, n) v[i][i] = A[i];
	build(0, n - 1);
}
int Query(int L, int R){
	return get(0, n - 1, L, R);
}

Compilation message

secret.cpp: In function 'void build(int, int)':
secret.cpp:95:26: error: return-statement with a value, in function returning 'void' [-fpermissive]
   95 |  if(l == r) return v[l][l];
      |                          ^
secret.cpp:97:24: error: invalid use of void expression
   97 |  v[l][r] = Secret(build(l, m), build(m + 1, r));
      |                   ~~~~~^~~~~~
secret.cpp:98:15: error: return-statement with a value, in function returning 'void' [-fpermissive]
   98 |  return v[l][r];
      |               ^
secret.cpp: In function 'int get(int, int, int, int)':
secret.cpp:106:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  106 |  if(x == -1) return y; if(y == -1) return x;
      |  ^~
secret.cpp:106:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  106 |  if(x == -1) return y; if(y == -1) return x;
      |                        ^~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:110:2: error: 'cin' was not declared in this scope
  110 |  cin >> N: n = N;
      |  ^~~
secret.cpp:28:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
   27 | #include <chrono>
  +++ |+#include <iostream>
   28 | 
secret.cpp:110:10: error: found ':' in nested-name-specifier, expected '::'
  110 |  cin >> N: n = N;
      |          ^
      |          ::
secret.cpp:110:9: error: 'N' is not a class, namespace, or enumeration
  110 |  cin >> N: n = N;
      |         ^