답안 #865874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865874 2023-10-25T01:42:48 Z Darren0724 Table Tennis (info1cup20_tabletennis) C++17
9 / 100
3000 ms 3188 KB
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));

int main(){
    int n,k;cin>>n>>k;
    vector<int> v(n+k);
    for(int i=0;i<n+k;i++){
        cin>>v[i];
    }
    int flag=0;
    auto check=[&](int p)->void {
        int j=n+k-1;
        int cnt=0;
        vector<int> ans;
        for(int i=0;i<n+k;i++){
            while(i<j&&v[i]+v[j]>p){
                j--;
            }
            if(i>=j){
                break;
            }
            if(i<j&&v[i]+v[j]==p){
                ans.push_back(v[i]);
                ans.push_back(v[j]);
                cnt+=2;
                j--;
            }
        }
        //cout<<ans.size()<<endl;
        if(cnt>=n){
            sort(ans.begin(),ans.begin()+n);
            for(int i=0;i<n;i++){
                cout<<ans[i]<<' ';
            }
            flag=1;
        }
    };
    for(int i=0;i<min(k+1,n);i++){
        for(int j=max(0,n-k-1);j<n;j++){
            check(v[i]+v[j]);
            if(flag){
                return 0;
            }
        }
    }

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 876 KB Output is correct
2 Incorrect 42 ms 860 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 3020 KB Output is correct
2 Correct 57 ms 3188 KB Output is correct
3 Incorrect 41 ms 1204 KB Unexpected end of file - int32 expected
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 7 ms 348 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 348 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 364 ms 860 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Execution timed out 3062 ms 860 KB Time limit exceeded
3 Halted 0 ms 0 KB -