답안 #1012636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1012636 2024-07-02T12:38:10 Z m5588ohammed Sticks (POI11_pat) C++14
52 / 100
163 ms 17748 KB
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
vector <int> v[51];
int n;
int find(int c,int num){
    int l=0,r=v[c].size()-1,j=-1;
    while(l<=r){
        int k=(l+r)/2;
        if(v[c][k]<num){
            j=v[c][k];
            l=k+1;
        }
        else r=k-1;
    }
    return j;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int k;
    cin>>k;
    for(int c=0;c<k;c++){
        cin>>n;
        v[c].resize(n);
        for(int i=0;i<n;i++) cin>>v[c][i];    
        sort(v[c].begin(),v[c].end());
    }
    for(int c=0;c<k;c++){
        for(int i:v[c]){
            vector <array<int,2>> valid;
            for(int c2=0;c2<k;c2++){
                if(c2!=c){
                    int a=find(c2,i);
                    if(a!=-1){
                        valid.push_back({c2,a});
                    }
                } 
            }
            sort(valid.begin(),valid.end());
            int l=valid.size();
            if(valid.size()>=2&&valid[l-1][1]+valid[l-2][1]>i){
                cout<<c+1<<" "<<i<<" "<<valid[l-1][0]+1<<" "<<valid[l-1][1]<<" "<<valid[l-2][0]+1<<" "<<valid[l-2][1]<<endl;
                exit(0);
            }
        }
    }
    cout<<"NIE"<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 464 KB Output is correct
2 Correct 0 ms 344 KB Oczekiwano NIE
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Oczekiwano NIE
2 Incorrect 8 ms 860 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Oczekiwano NIE
2 Incorrect 10 ms 1052 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Oczekiwano NIE
2 Incorrect 24 ms 1936 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 856 KB Oczekiwano NIE
2 Incorrect 44 ms 2908 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 1368 KB Oczekiwano NIE
2 Correct 35 ms 4692 KB Output is correct
3 Correct 41 ms 2648 KB Oczekiwano NIE
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 9040 KB Output is correct
2 Incorrect 100 ms 5728 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 8952 KB Output is correct
2 Incorrect 117 ms 6224 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 132 ms 17748 KB Output is correct
2 Correct 105 ms 6996 KB Output is correct
3 Correct 119 ms 7472 KB Oczekiwano NIE
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 17748 KB Output is correct
2 Correct 59 ms 8272 KB Output is correct
3 Correct 163 ms 9040 KB Oczekiwano NIE