# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
747414 | 2023-05-24T07:07:31 Z | vjudge1 | Kralj (COCI16_kralj) | C++17 | 643 ms | 50636 KB |
#include <bits/stdc++.h> #include <array> #define all(v) (v.begin()), (v.end()) #define setall(a, val) for(auto& x : a) x = val #define ll long long #define cerr (cerr << "D: ") clock_t start_time; using namespace std; double get_time() { return (double)(clock() - start_time) / CLOCKS_PER_SEC; } void init(bool oj = 1) { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); start_time = clock(); if (oj) { #ifndef ONLINE_JUDGE FILE* _ = freopen("in.txt", "r", stdin); //FILE* __ = freopen("out.txt", "w", stdout); #endif } } const ll MOD = 1e9 + 7; const ll N = 5e5 + 7; const ll M = 2e3 + 7; //#################################################################################### int n; bool vis[N]; vector<int> a; multiset<int> b; int solve(int i) { if (i == n) return 0; auto it = b.upper_bound(a[i]); if (it == b.end()) it = b.begin(); int f = *it; b.erase(it); int ret = solve(i + 1) + (f > a[i]); b.insert(f); return ret; } int main() { init(0); cin >> n; a.resize(n); for (int i = 0; i < n; i++) {int _; cin >> _;} for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { int x; cin >> x; b.insert(x); } sort(all(a)); cout << solve(0) << endl; cerr << get_time() << "s" << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 475 ms | 40780 KB | Output is correct |
2 | Correct | 457 ms | 39880 KB | Output is correct |
3 | Correct | 617 ms | 49328 KB | Output is correct |
4 | Correct | 618 ms | 50596 KB | Output is correct |
5 | Incorrect | 599 ms | 45956 KB | Output isn't correct |
6 | Incorrect | 570 ms | 45688 KB | Output isn't correct |
7 | Incorrect | 597 ms | 47732 KB | Output isn't correct |
8 | Incorrect | 516 ms | 43064 KB | Output isn't correct |
9 | Incorrect | 632 ms | 50512 KB | Output isn't correct |
10 | Incorrect | 643 ms | 50636 KB | Output isn't correct |