# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845927 | 2023-09-06T19:52:37 Z | samekkk | Table Tennis (info1cup20_tabletennis) | C++14 | 3000 ms | 4788 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a,b) for (int a = 0; a < (b); ++a) #define pb push_back #define all(t) t.begin(), t.end() const int max_N = 160005; int n = 0, k = 0; int A[max_N]; vector<int> V; vector<int> wyn; inline bool czy_pasuje(int val1, int val2) { if (val1 == val2) return false; wyn = vector<int>(); wyn.pb(val1), wyn.pb(val2); if (n == 2) return true; vector<int> vect; rep(i,n+k) if (A[i] != val1 and A[i] != val2) vect.pb(A[i]); int sum = val1 + val2, lewy_wsk = 0, prawy_wsk = vect.size()-1; while(lewy_wsk < prawy_wsk) { if(vect[lewy_wsk] == val1 or vect[lewy_wsk] == val2) ++lewy_wsk; if(vect[prawy_wsk] == val1 or vect[prawy_wsk] == val2) --prawy_wsk; if(vect[lewy_wsk] == val1 or vect[lewy_wsk] == val2 or vect[prawy_wsk] == val1 or vect[prawy_wsk] == val2) continue; if (vect[lewy_wsk] + vect[prawy_wsk] == sum) { wyn.pb(vect[lewy_wsk]), wyn.pb(vect[prawy_wsk]); if (n == wyn.size()) return true; ++lewy_wsk, --prawy_wsk; } else if (vect[lewy_wsk] + vect[prawy_wsk] > sum) --prawy_wsk; else ++lewy_wsk; } return false; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; rep(i,n+k) cin >> A[i]; rep(i,k) V.pb(A[i]); for (int i = n; i < n+k; ++i) V.pb(A[i]); rep(i,V.size()) { for (int j = i+1; j < V.size(); ++j) { if (czy_pasuje(V[i],V[j]) == true) { sort(all(wyn)); for (auto v : wyn) cout << v << ' '; cout << '\n'; return 0; } } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 780 KB | Output is correct |
2 | Incorrect | 12 ms | 2012 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 4584 KB | Output is correct |
2 | Incorrect | 17 ms | 2652 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 15 ms | 464 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 8 ms | 468 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 5 ms | 492 KB | Output is correct |
3 | Incorrect | 6 ms | 348 KB | Unexpected end of file - int32 expected |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 561 ms | 4696 KB | Output is correct |
3 | Correct | 43 ms | 4788 KB | Output is correct |
4 | Correct | 264 ms | 4684 KB | Output is correct |
5 | Correct | 51 ms | 4644 KB | Output is correct |
6 | Correct | 175 ms | 4664 KB | Output is correct |
7 | Correct | 282 ms | 4676 KB | Output is correct |
8 | Correct | 51 ms | 4700 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Execution timed out | 3078 ms | 3036 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |