Submission #83670

# Submission time Handle Problem Language Result Execution time Memory
83670 2018-11-09T18:19:41 Z nikolapesic2802 Sticks (POI11_pat) C++14
28 / 100
1000 ms 33796 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

int main()
{
    int k;
    scanf("%i",&k);
    vector<set<int> > sets(k);
    for(int i=0;i<k;i++)
    {
        sets[i].insert(INT_MAX);
        int n;
        scanf("%i",&n);
        for(int j=0;j<n;j++)
        {
            int a;
            scanf("%i",&a);
            sets[i].insert(a);
        }
    }
    for(int i=0;i<k;i++)
    {
        for(auto p:sets[i])
        {
            if(p==INT_MAX)
                continue;
            int m1=INT_MAX,m2=INT_MAX,c1,c2;
            for(int j=0;j<k;j++)
            {
                if(i==j)
                    continue;
                int v=*sets[j].lower_bound(p);
                if(v<m1)
                {
                    m2=m1;
                    c2=c1;
                    m1=v;
                    c1=j;
                }
                else
                {
                    if(v<m2)
                    {
                        m2=v;
                        c2=j;
                    }
                }
            }
            if(m1!=INT_MAX&&m2!=INT_MAX)
            {
                if(p+m1>m2)
                {
                    printf("%i %i %i %i %i %i\n",i+1,p,c1+1,m1,c2+1,m2);
                    return 0;
                }
            }
        }
    }
    printf("NIE\n");
    return 0;
}

Compilation message

pat.cpp: In function 'int main()':
pat.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&k);
     ~~~~~^~~~~~~~~
pat.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i",&n);
         ~~~~~^~~~~~~~~
pat.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%i",&a);
             ~~~~~^~~~~~~~~
pat.cpp:57:27: warning: 'c2' may be used uninitialized in this function [-Wmaybe-uninitialized]
                     printf("%i %i %i %i %i %i\n",i+1,p,c1+1,m1,c2+1,m2);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pat.cpp:57:27: warning: 'c1' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 624 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 2 ms 624 KB Oczekiwano NIE
2 Incorrect 21 ms 2356 KB Expected integer, but "NIE" found
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2356 KB Oczekiwano NIE
2 Incorrect 26 ms 3184 KB Expected integer, but "NIE" found
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3184 KB Oczekiwano NIE
2 Incorrect 82 ms 6888 KB Expected integer, but "NIE" found
# Verdict Execution time Memory Grader output
1 Correct 17 ms 6888 KB Oczekiwano NIE
2 Incorrect 150 ms 10872 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 66 ms 10872 KB Oczekiwano NIE
2 Incorrect 267 ms 18724 KB Expected integer, but "NIE" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 366 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 367 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 654 ms 33792 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 33796 KB Time limit exceeded
2 Halted 0 ms 0 KB -