제출 #635181

#제출 시각아이디문제언어결과실행 시간메모리
635181marvinthang드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
/************************************* * author: marvinthang * * created: 25.08.2022 22:19:29 * *************************************/ #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define div ___div #define left ___left #define right ___right #define TIME (1.0 * clock() / CLOCKS_PER_SEC) #define MASK(i) (1LL << (i)) #define FULL(i) (MASK(i) - 1) #define BIT(x, i) ((x) >> (i) & 1) #define __builtin_popcount __builtin_popcountll #define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u) #define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u) #define file(name) if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); } template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; } template <class T> print_op(vector <T>) { out << '{'; for (size_t i = 0; i + 1 < u.size(); ++i) out << u[i] << ", "; if (!u.empty()) out << u.back(); return out << '}'; } template <class U, class V> scan_op(pair <U, V>) { return in >> u.fi >> u.se; } template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.fi << ", " << u.se << ')'; } const double PI = 3.1415926535897932384626433832795; // acos(-1.0); atan(-1.0); const int dir[] = {1, 0, -1, 0, 1, 1, -1, -1, 1}; // {2, 1, -2, -1, -2, 1, 2, -1, 2}; set <int> insides; void add(int i) { move_inside(i); insides.insert(i); } void remove(int i) { move_outside(i); insides.erase(i); } void reset_machine(void) { set <int> tmp = insides; for (int i: tmp) remove(i); } int min_cardinality(int n) { for (int i = 0; i < n; ++i) { add(i); if (press_button() > 1) remove(i); } int unique_vals = insides.size(); reset_machine(); int l = 2, r = n / unique_vals; while (l <= r) { int m = l + r >> 1; for (int i = 0; i < n; ++i) { add(i); if (press_button() > mid) remove(i); } int total = insides.size(); reset_machine(); if (total >= unique_vals * mid) l = m + 1; else r = m - 1; } return r; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); // cout.tie(nullptr); file("ioi22_day2_insects"); cerr << "Time elapsed: " << TIME << " s.\n"; return (0^0); }

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'void add(int)':
insects.cpp:35:2: error: 'move_inside' was not declared in this scope
   35 |  move_inside(i);
      |  ^~~~~~~~~~~
insects.cpp: In function 'void remove(int)':
insects.cpp:40:2: error: 'move_outside' was not declared in this scope
   40 |  move_outside(i);
      |  ^~~~~~~~~~~~
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:52:7: error: 'press_button' was not declared in this scope
   52 |   if (press_button() > 1) remove(i);
      |       ^~~~~~~~~~~~
insects.cpp:58:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   58 |   int m = l + r >> 1;
      |           ~~^~~
insects.cpp:61:8: error: 'press_button' was not declared in this scope
   61 |    if (press_button() > mid) remove(i);
      |        ^~~~~~~~~~~~
insects.cpp:61:25: error: 'mid' was not declared in this scope
   61 |    if (press_button() > mid) remove(i);
      |                         ^~~
insects.cpp:65:30: error: 'mid' was not declared in this scope
   65 |   if (total >= unique_vals * mid) l = m + 1;
      |                              ^~~
insects.cpp: In function 'int main()':
insects.cpp:22:69: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 | #define          file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
insects.cpp:73:2: note: in expansion of macro 'file'
   73 |  file("ioi22_day2_insects");
      |  ^~~~
insects.cpp:22:103: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 | #define          file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                                                               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
insects.cpp:73:2: note: in expansion of macro 'file'
   73 |  file("ioi22_day2_insects");
      |  ^~~~