# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
519870 | 2022-01-27T13:07:14 Z | cig32 | Road Construction (JOI21_road_construction) | C++17 | 10000 ms | 6864 KB |
#pragma GCC optimize("Ofast") #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cwchar> #include <cwctype> #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <array> #include <atomic> #include <chrono> #include <codecvt> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> using namespace std; mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count()); const int MAXN = 3e5 + 10; const int MOD = 1e9 + 7; #define int long long int rnd(int x, int y) { int u = uniform_int_distribution<int>(x, y)(rng); return u; } void solve(int tc) { int n, k; cin >> n >> k; int x[n+1], y[n+1]; for(int i=1; i<=n; i++) { cin >> x[i] >> y[i]; } sort(x+1, x+n+1); priority_queue<int> pq; for(int i=1; i<=n; i++) { for(int j=1; j<=2 * sqrt(k) + 5; j++) { if(i + j <= n) pq.push(x[i + j] - x[i]); else break; } while(pq.size() > k) { pq.pop(); } } stack<int> st; while(pq.size()) { st.push(pq.top()); pq.pop(); } while(st.size()) { cout << st.top() << "\n"; st.pop(); } } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; for(int i=1; i<=t; i++) solve(i); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 6864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 10100 ms | 6388 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 95 ms | 4172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 95 ms | 4172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 6864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 6864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |