제출 #981966

#제출 시각아이디문제언어결과실행 시간메모리
981966vjudge1서열 (APIO23_sequence)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int sequence(int n, vector <long long> a){ vector <vector <long long>> repe(n+1, vector<long long>(n+1)); for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ repe[i][j] = repe[i][j-1] + (a[j-1] == i); } } long long ans = 0; for(int i=0; i<n; i++){ ordered_set st; for(int j=i; j<n; j++){ st.insert(a[j]); int x = st.order_of_key(j/2); int y = st.order_of_key((j+1)/2); ans = max(ans, repe[x][j+1]-repe[x][i]); } st.clear(); } return ans; }

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

sequence.cpp: In function 'int sequence(int, std::vector<long long int>)':
sequence.cpp:29:17: warning: unused variable 'y' [-Wunused-variable]
   29 |             int y = st.order_of_key((j+1)/2);
      |                 ^
/usr/bin/ld: /tmp/ccNPxryL.o: in function `main':
grader.cpp:(.text.startup+0x2a4): undefined reference to `sequence(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status