제출 #1277088

#제출 시각아이디문제언어결과실행 시간메모리
1277088nanaseyuzukiXylophone (JOI18_xylophone)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> // Author: Kazuki_Will_Win_VOI_8703 #define fi first #define se second #define pii pair<int, int> #define int long long #define all(a) a.begin(), a.end() using namespace std; const int mn = 1e6 + 1, bm = (1 << 15) + 1, mod = 1532023; const int inf = 1e9, base = 311; vector <int> merge(int ll, int rr){ if(ll == rr){ vector <int> ans; ans.push_back(ll); return ans; } vector <int> ans; int mid = (ll + rr) >> 1; vector <int> l = merge(ll, mid); vector <int> r = merge(mid + 1, rr); int i = 0, j = 0; while(i < l.size() && j < r.size()){ int kq = query(l[i], r[j]); if(kq < 0){ ans.push_back(l[i]); i ++; } else{ ans.push_back(r[j]); j ++; } } while(i < l.size()) ans.push_back(l[i++]); while(j < r.size()) ans.push_back(r[j++]); return ans; } int solve(int n){ cin >> n; vector <int> kq = merge(1, n); vector <pii> Megumi; for(int i = 0; i < n; i++){ Megumi.push_back({kq[i], i + 1}); } sort(all(Megumi)); for(auto [j, i] : Megumi) answer(j, i + 1); }

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

xylophone.cpp: In function 'std::vector<long long int> merge(long long int, long long int)':
xylophone.cpp:25:18: error: 'query' was not declared in this scope
   25 |         int kq = query(l[i], r[j]);
      |                  ^~~~~
xylophone.cpp: In function 'long long int solve(long long int)':
xylophone.cpp:48:31: error: 'answer' was not declared in this scope
   48 |     for(auto [j, i] : Megumi) answer(j, i + 1);
      |                               ^~~~~~
xylophone.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^