# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
133894 | 2019-07-21T16:37:02 Z | osaaateiasavtnl | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 9000 ms | 884 KB |
#include<bits/stdc++.h> using namespace std; #define app push_back #define ii pair <int, int> #define mp make_pair int get(vector <int> a) { int n = a.size(); int ans = 0; while (1) { auto t = a; sort(t.begin(), t.end()); if (t == a) return ans; for (int i = 0; i + 1 < n; ++i) { if (a[i + 1] < a[i]) swap(a[i], a[i + 1]); } ++ans; } return ans; } vector <int> countScans(vector <int> a, vector <int> p, vector <int> x) { for (auto &e : p) --e; int n = a.size(), q = p.size(); vector <int> ans; for (int i = 0; i < q; ++i) { a[p[i]] = x[i]; ans.app(get(a)); } return ans; } #ifdef HOME signed main() { //freopen("input.txt", "r", stdin); int n, q; cin >> n >> q; vector <int> a(n), p(q), x(q); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < q; ++i) cin >> p[i] >> x[i]; vector <int> ans = countScans(a, p, x); for (int e : ans) cout << e << '\n'; } #endif
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4077 ms | 884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4077 ms | 884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 9031 ms | 760 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4077 ms | 884 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |