제출 #1295707

#제출 시각아이디문제언어결과실행 시간메모리
1295707eldaees131313Unscrambling a Messy Bug (IOI16_messy)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <bits/stdc++.h> #define int long long #define str string #define vec vector #define dou double #define ld long double #define pb push_back #define ppb pop_back #define eb emplace_back #define OK cout << "OK" << '\n' #define Ok cout << "Ok" << '\n' #define YES cout << "YES" << '\n' #define Yes cout << "Yes" << '\n' #define NO cout << "NO" << '\n' #define No cout << "No" << '\n' #define gcd __gcd #define all(x) x.begin(),x.end() #define eldaee ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); void add_element(str s) {} void compile_set() {} bool check_element(str s) { return false; } vec<int> v(int n, int w, int r) { vector<int> z(n); for (int i = 0; i < n; i++) { str s(n, '0'); s[i] = '1'; add_element(s); } compile_set(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { string s(n, '0'); s[j] = '1'; if (check_element(s)) { z[i] = j; break; } } } return z; }

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

messy.cpp:21:6: error: variable or field 'add_element' declared void
   21 | void add_element(str s) {}
      |      ^~~~~~~~~~~
messy.cpp:4:13: error: 'string' was not declared in this scope
    4 | #define str string
      |             ^~~~~~
messy.cpp:21:18: note: in expansion of macro 'str'
   21 | void add_element(str s) {}
      |                  ^~~
messy.cpp:4:13: note: suggested alternatives:
    4 | #define str string
      |             ^~~~~~
messy.cpp:21:18: note: in expansion of macro 'str'
   21 | void add_element(str s) {}
      |                  ^~~
In file included from /usr/include/c++/13/string:41,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from messy.cpp:1:
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
messy.cpp:4:13: error: 'string' was not declared in this scope
    4 | #define str string
      |             ^~~~~~
messy.cpp:23:20: note: in expansion of macro 'str'
   23 | bool check_element(str s) {
      |                    ^~~
messy.cpp:4:13: note: suggested alternatives:
    4 | #define str string
      |             ^~~~~~
messy.cpp:23:20: note: in expansion of macro 'str'
   23 | bool check_element(str s) {
      |                    ^~~
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
messy.cpp:5:13: error: 'vector' does not name a type
    5 | #define vec vector
      |             ^~~~~~
messy.cpp:26:1: note: in expansion of macro 'vec'
   26 | vec<int> v(int n, int w, int r) {
      | ^~~
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~