# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
972185 | 2024-04-30T08:23:36 Z | penguin133 | Table Tennis (info1cup20_tabletennis) | C++17 | 3000 ms | 5844 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, k, A[200005]; void solve(){ cin >> n >> k; for(int i = 1; i <= n + k; i++)cin >> A[i]; for(int i = 1; i <= k; i++){ for(int j = n + k; j >= n; j--){ if(i - 1 + n + k - j > k)continue; int l = i + 1, r = j - 1, cnt = 1, tar = A[i] + A[j]; while(l <= r){ while(r >= l && A[l] + A[r] > tar)r--; if(r <= l)break; if(A[l] + A[r] == tar)cnt++; l++; r--; } //cerr << i << ' ' << j << ' ' << cnt << '\n'; if(cnt >= n / 2){ vector <int> v; v.push_back(A[i]); v.push_back(A[j]); l = i + 1, r = j - 1, tar = A[i] + A[j]; while(l <= r){ while(r >= l && A[l] + A[r] > tar)r--; if(r <= l)break; if(A[l] + A[r] == tar && v.size() < n)v.push_back(A[l]), v.push_back(A[r]); l++; r--; } sort(v.begin(), v.end()); for(auto a : v)cout << a << ' '; cout << '\n'; return; } } } assert(0); } main(){ ios::sync_with_stdio(0);cin.tie(0); int tc = 1; //cin >> tc; for(int tc1=1;tc1<=tc;tc1++){ // cout << "Case #" << tc1 << ": "; solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1116 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 5844 KB | Output is correct |
2 | Correct | 26 ms | 5844 KB | Output is correct |
3 | Runtime error | 17 ms | 4436 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Runtime error | 1 ms | 664 KB | Execution killed with signal 6 |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 44 ms | 5780 KB | Output is correct |
3 | Runtime error | 31 ms | 4348 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Execution timed out | 3044 ms | 2908 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |