답안 #865891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865891 2023-10-25T02:17:32 Z Darren0724 Table Tennis (info1cup20_tabletennis) C++17
9 / 100
3000 ms 4592 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]<<' ';
            }
            cout<<endl;
            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;
            }
        }
    }
    assert(false);

}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 980 KB Output is correct
2 Runtime error 45 ms 3044 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 4592 KB Output is correct
2 Correct 57 ms 4548 KB Output is correct
3 Runtime error 44 ms 3412 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 5 ms 436 KB Execution killed with signal 6
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 348 KB Output is correct
2 Runtime error 2 ms 604 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 329 ms 3068 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3034 ms 2280 KB Time limit exceeded
3 Halted 0 ms 0 KB -