제출 #774757

#제출 시각아이디문제언어결과실행 시간메모리
774757vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
컴파일 에러
0 ms0 KiB
// #pragma GCC target("abm") // #pragma GCC optimize("03,unroll-loops") // #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("bmi,bmi2,lzcnt,popcnt") // #pragma GCC target("avx2") #include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr) #define put(a) cout << a << "\n" #define put_2(a, b) cout << a << " " << b << "\n" #define put_3(a, b, c) cout << a << " " << b << " " << c << "\n" #define put_4(a, b, c, x) cout << a << " " << b << " " << c << " " << x << "\n" #define put_5(a, b, c, x, y) cout << a << " " << b << " " << c << " " << x << " " << y << "\n"; #define put_6(a, b, c, x, y, z) cout << a << " " << b << " " << c << " " << x << " " << y << " " << z << "\n"; #define put_fix(a, n) cout << fixed << setprecision(n) << a << "\n" #define ll long long #define ldb long double #define db double #define sqr(x) (x*x) #define fto(i, a, b) for (int i = a; i <= b; ++i) #define fdto(i, b, a) for (int i = b; i >= a; --i) #define sz(a) (int) (a.size()) #define di deque <int> #define vi vector <int> #define vl vector <long long> #define pii pair <int, int> #define vii vector <int, int> #define vpii vector<pair<int, int>> #define pf push_front #define pb push_back #define ppf pop_front #define ppb pop_back #define eb emplace_back #define mp make_pair #define ff first #define ss second #define oo 1000000007 #define OO 1000000000000000007 #define eps 0.0000000001 #define mod #define maxN 200005 #define maxM 10000005 using namespace std; int n, a[maxN]; void sub_1() { fto(i, 2, n) { int pos = 0; fdto(j, i-1, 1) { if (a[j] == a[i]) { pos = j; break; } } if (pos) fto(j, pos+1, i-1) a[j] = a[i]; } fto(i, 1, n) put(a[i]); } struct data { int l, r, val; }; int mx_pos_val[5]; void sub_2() { vector<data> vec; mx_pos_val[a[1]] = 1; fto(i, 2, n) { if (a[i] == a[mx_pos_val[a[i]]]) { vec.pb({mx_pos_val[a[i]], i, a[i]}); mx_pos_val[a[i]] = i; } } fto(ivec, 0, sz(vec) - 1) { fto(i, vec[ivec].l, vec[ivec].r) a[i] = vec[ivec].val; } fto(i, 1, n) put(a[i]); } int main () { // #ifndef ONLINE_JUDGE // freopen("test.inp", "r", stdin); // freopen("test.out", "w", stdout); // #endif // ONLINE_JUDGE FAST; cin >> n; bool ok_o = false; fto(i, 1, n) { cin >> a[i]; if (a[i] != 1 && a[2] != 2) ok_o = true; } if (n <= 10000) sub_1(); else if (!ok_o) sub_2(); return 0; }

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

Main.cpp: In function 'void sub_2()':
Main.cpp:81:16: error: template argument 1 is invalid
   81 |     vector<data> vec;
      |                ^
Main.cpp:81:16: error: template argument 2 is invalid
Main.cpp:39:12: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
   39 | #define pb push_back
      |            ^~~~~~~~~
Main.cpp:85:17: note: in expansion of macro 'pb'
   85 |             vec.pb({mx_pos_val[a[i]], i, a[i]});
      |                 ^~
Main.cpp:28:24: error: request for member 'size' in 'vec', which is of non-class type 'int'
   28 | #define sz(a) (int) (a.size())
      |                        ^~~~
Main.cpp:25:43: note: in definition of macro 'fto'
   25 | #define fto(i, a, b) for (int i = a; i <= b; ++i)
      |                                           ^
Main.cpp:90:18: note: in expansion of macro 'sz'
   90 |     fto(ivec, 0, sz(vec) - 1) {
      |                  ^~
Main.cpp:91:19: error: invalid types 'int[int]' for array subscript
   91 |         fto(i, vec[ivec].l, vec[ivec].r) a[i] = vec[ivec].val;
      |                   ^
Main.cpp:25:35: note: in definition of macro 'fto'
   25 | #define fto(i, a, b) for (int i = a; i <= b; ++i)
      |                                   ^
Main.cpp:91:32: error: invalid types 'int[int]' for array subscript
   91 |         fto(i, vec[ivec].l, vec[ivec].r) a[i] = vec[ivec].val;
      |                                ^
Main.cpp:25:43: note: in definition of macro 'fto'
   25 | #define fto(i, a, b) for (int i = a; i <= b; ++i)
      |                                           ^
Main.cpp:91:52: error: invalid types 'int[int]' for array subscript
   91 |         fto(i, vec[ivec].l, vec[ivec].r) a[i] = vec[ivec].val;
      |                                                    ^