제출 #1014124

#제출 시각아이디문제언어결과실행 시간메모리
1014124atomAbracadabra (CEOI22_abracadabra)C++17
10 / 100
149 ms18256 KiB
#include "bits/stdc++.h" // @JASPER'S BOILERPLATE using namespace std; using ll = long long; #ifdef JASPER #include "debug.h" #else #define debug(...) 166 #endif const int N = 1e5 + 5; vector <int> ans[N]; signed main() { cin.tie(0) -> sync_with_stdio(0); #ifdef JASPER freopen("in1", "r", stdin); #endif int n, q; cin >> n >> q; vector <int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; if (n <= 1000) { int m = n / 2; ans[0] = a; for (int t = 1; t <= n; ++t) { queue <int> l, r; vector <int> b; for (int i = 0; i < m; ++i) l.push(a[i]); for (int i = m; i < n; ++i) r.push(a[i]); while (!l.empty() || !r.empty()) { if (!l.empty() && !r.empty() && l.front() < r.front()) { b.push_back(l.front()); l.pop(); } if (!l.empty() && !r.empty() && l.front() > r.front()) { b.push_back(r.front()); r.pop(); } if (l.empty()) { while (!r.empty()) { b.push_back(r.front()); r.pop(); } } if (r.empty()) { while (!l.empty()) { b.push_back(l.front()); l.pop(); } } } debug(b); ans[t] = b; a = b; } while (q--) { int x, i; cin >> x >> i; x = min(x, n); cout << ans[x][i - 1] << "\n"; } } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:9:20: warning: statement has no effect [-Wunused-value]
    9 | #define debug(...) 166
      |                    ^~~
Main.cpp:59:13: note: in expansion of macro 'debug'
   59 |             debug(b);
      |             ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...