Submission #1012638

# Submission time Handle Problem Language Result Execution time Memory
1012638 2024-07-02T12:43:16 Z m5588ohammed Sticks (POI11_pat) C++14
52 / 100
157 ms 8276 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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Oczekiwano NIE
2 Incorrect 7 ms 604 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Oczekiwano NIE
2 Incorrect 10 ms 604 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Oczekiwano NIE
2 Incorrect 26 ms 1068 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 604 KB Oczekiwano NIE
2 Incorrect 44 ms 1676 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 856 KB Oczekiwano NIE
2 Correct 31 ms 2392 KB Output is correct
3 Correct 40 ms 1628 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 61 ms 4220 KB Output is correct
2 Incorrect 94 ms 2968 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 4180 KB Output is correct
2 Incorrect 121 ms 3164 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 124 ms 8276 KB Output is correct
2 Correct 98 ms 3412 KB Output is correct
3 Correct 115 ms 3668 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 122 ms 8276 KB Output is correct
2 Correct 54 ms 4068 KB Output is correct
3 Correct 157 ms 4436 KB Oczekiwano NIE