Submission #97010

# Submission time Handle Problem Language Result Execution time Memory
97010 2019-02-13T09:16:49 Z Kastanda Carnival (CEOI14_carnival) C++11
100 / 100
40 ms 512 KB
// Awesome feelings
#include<bits/stdc++.h>
using namespace std;
const int N = 155;
int n, ts, C[N];
inline int Query(int l, int r)
{
    printf("%d", r - l + 1);
    for (int i = l; i <= r; i++)
        printf(" %d", i);
    printf("\n"); fflush(stdout);
    int k; scanf("%d", &k);
    return (k);
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        if (!C[i])
            C[i] = ++ ts;
        int le = i, ri = n + 1, md;
        while (ri - le > 1)
        {
            md = (le + ri) >> 1;
            if (Query(i + 1, md) < Query(i, md))
                le = md;
            else
                ri = md;
        }
        C[ri] = C[i];
    }
    printf("0");
    for (int i = 1; i <= n; i++)
        printf(" %d", C[i]);
    printf("\n"); fflush(stdout);
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
carnival.cpp: In function 'int Query(int, int)':
carnival.cpp:12:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int k; scanf("%d", &k);
            ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 20 ms 256 KB Output is correct
3 Correct 32 ms 384 KB Output is correct
4 Correct 25 ms 384 KB Output is correct
5 Correct 15 ms 256 KB Output is correct
6 Correct 20 ms 384 KB Output is correct
7 Correct 23 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 25 ms 256 KB Output is correct
3 Correct 17 ms 384 KB Output is correct
4 Correct 25 ms 384 KB Output is correct
5 Correct 30 ms 256 KB Output is correct
6 Correct 19 ms 256 KB Output is correct
7 Correct 26 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 22 ms 256 KB Output is correct
3 Correct 14 ms 256 KB Output is correct
4 Correct 40 ms 256 KB Output is correct
5 Correct 11 ms 512 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 28 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 384 KB Output is correct
2 Correct 22 ms 256 KB Output is correct
3 Correct 21 ms 384 KB Output is correct
4 Correct 33 ms 384 KB Output is correct
5 Correct 27 ms 256 KB Output is correct
6 Correct 22 ms 304 KB Output is correct
7 Correct 20 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 384 KB Output is correct
2 Correct 22 ms 256 KB Output is correct
3 Correct 29 ms 392 KB Output is correct
4 Correct 26 ms 256 KB Output is correct
5 Correct 24 ms 256 KB Output is correct
6 Correct 24 ms 384 KB Output is correct
7 Correct 34 ms 256 KB Output is correct