Submission #1056100

#TimeUsernameProblemLanguageResultExecution timeMemory
1056100BlockOGFloppy (RMI20_floppy)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <random> #include <climits> #include <utility> #include <vector> #include <queue> #include <set> #include <bitset> #include <fstream> #include "floppy.h" #define ll long long // #define int ll #define endl '\n' #define pb push_back #define f first #define s second #define fo(i, a, b) for (auto i = (a); i < (b); i++) #define of(i, a, b) for (auto i = (b); i-- > (a);) #define lb lower_bound #define ub upper_bound #define be(a) a.begin(), a.end() #define MAX INT_MAX #define LMAX LONG_LONG_MAX #define MIN INT_MIN #define LMIN LONG_LONG_MIN using namespace std; int init_____ = []{ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0; }(); template<typename T> bool mis(T &a, const T &b) { return b < a ? a = b, true : false; } template<typename T> bool mas(T &a, const T &b) { return b > a ? a = b, true : false; } template<typename T> bool mise(T &a, const T &b) { return b <= a ? a = b, true : false; } template<typename T> bool mase(T &a, const T &b) { return b >= a ? a = b, true : false; } template<typename T> bool gcd(const T &a, const T &b) { return a > b ? gcd(b, a) : (a == T(0) ? b : gcd(b % a, a)); } template<typename T> bool lcm(const T &a, const T &b) { return a * b / gcd(a, b); } // mt19937 rng(time(NULL)); // int rand(int a, int b) { // return a + rng() % (b - a); // } // string floppy; // void save_to_floppy(string &bits) { // floppy = bits; // } // int32_t main() { // int n; cin >> n; // vector<int> v(n); fo(i, 0, n) cin >> v[i]; // } pair<int, int> a[40000]; int b[40000]; int N = 65536; int c[N * 2]; int d[N * 2]; void read_array(int subtask_id, const vector<int> &v) { ofstream out("asdsdassdsad"); fo(i, 0, v.size()) out << v[i] << ' '; // int n = v.size(); // fo(i, 0, n) a[i] = { v[i], i }; // sort(a, a + n); // fo(i, 0, n) b[a[i].s] = i; // string res; // fo(i, 0, n) { // int k = 1 << 13; // fo(j, 0, 14) { // if (b[i] & k) res += '1'; // else res += '0'; // k >>= 1; // } // } // save_to_floppy(res); save_to_floppy("0"); } pair<int, int> get_max(int i, int cl, int cr, int l, int r) { if (l <= cl && cr <= r) return { c[i], d[i] }; int mid = (cl + cr) / 2; pair<int, int> res = { INT_MIN, 0 }; if (cl < r || l < mid) { pair<int, int> asd = get_max(i * 2, cl, mid, l, r); if (asd.f > res.f) res = asd; } if (mid < r || l < cr) { pair<int, int> asd = get_max(i * 2 + 1, mid, cr, l, r); if (asd.f > res.f) res = asd; } return res; } vector<int> solve_queries(int subtask_id, int n, const string &bits, const vector<int> &a, const vector<int> &b) { ifstream in("asdsdassdsad"); fill(c + N, c + N * 2, MIN); fo(i, 0, n) { in >> c[i + N]; d[i + N] = i; } of(i, 1, N) { if (c[i * 2] >= c[i * 2 + 1]) { c[i] = c[i * 2]; d[i] = d[i * 2]; } else { c[i] = c[i * 2 + 1]; d[i] = d[i * 2 + 1]; } } vector<int> res; fo(i, 0, a.size()) { res.pb(get_max(1, 0, N, a[i], b[i] + 1).s); } return res; }

Compilation message (stderr)

floppy.cpp:65:12: error: array bound is not an integer constant before ']' token
   65 | int c[N * 2];
      |            ^
floppy.cpp:66:12: error: array bound is not an integer constant before ']' token
   66 | int d[N * 2];
      |            ^
floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | #define fo(i, a, b) for (auto i = (a); i < (b); i++)
      |                                          ^
floppy.cpp:70:5: note: in expansion of macro 'fo'
   70 |     fo(i, 0, v.size()) out << v[i] << ' ';
      |     ^~
floppy.cpp: In function 'std::pair<int, int> get_max(int, int, int, int, int)':
floppy.cpp:92:38: error: 'c' was not declared in this scope
   92 |     if (l <= cl && cr <= r) return { c[i], d[i] };
      |                                      ^
floppy.cpp:92:44: error: 'd' was not declared in this scope
   92 |     if (l <= cl && cr <= r) return { c[i], d[i] };
      |                                            ^
floppy.cpp:92:49: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
   92 |     if (l <= cl && cr <= r) return { c[i], d[i] };
      |                                                 ^
      |                                                 |
      |                                                 <brace-enclosed initializer list>
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:110:10: error: 'c' was not declared in this scope
  110 |     fill(c + N, c + N * 2, MIN);
      |          ^
floppy.cpp:113:9: error: 'd' was not declared in this scope
  113 |         d[i + N] = i;
      |         ^
floppy.cpp:119:13: error: 'd' was not declared in this scope
  119 |             d[i] = d[i * 2];
      |             ^
floppy.cpp:122:13: error: 'd' was not declared in this scope
  122 |             d[i] = d[i * 2 + 1];
      |             ^
floppy.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | #define fo(i, a, b) for (auto i = (a); i < (b); i++)
      |                                          ^
floppy.cpp:127:5: note: in expansion of macro 'fo'
  127 |     fo(i, 0, a.size()) {
      |     ^~
stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~