Submission #314267

# Submission time Handle Problem Language Result Execution time Memory
314267 2020-10-19T10:02:07 Z kubo Detecting Molecules (IOI16_molecules) C
0 / 100
0 ms 256 KB
#include <stdio.h>
#include <stdlib.h>


int cmpfunc (const void * a, const void * b)
{
    return ( *(int*)a - *(int*)b );
}


int find_subset (int l, int u, int w[], int n, int result[])
{
    qsort(w, n, sizeof(int), cmpfunc);
    int i = 0, j = 0;
    long v = 0;
    do {
        if (v < l && j<n-1) {
            v += w[j++];
        } else if (v > u && i<n) {
            v -= w[i++];
        } else {
            break;
        }
        printf("%d %d %ld\n", i, j, v);
    } while (1);
    if (v>=l && v>=u) {
        for (int k=i; k<j; ++k)
            result[k-i] = w[k];
        return j-i;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Secret is incorrect!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -