Submission #164469

# Submission time Handle Problem Language Result Execution time Memory
164469 2019-11-21T02:17:58 Z mhy908 Carnival (CEOI14_carnival) C++14
0 / 100
27 ms 376 KB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const LL llinf=9000000000000000000;
const int inf=2000000000;
int query(int a, int b){
    printf("%d ", b-a+1);
    for(int i=a; i<=b; i++)printf("%d ", i);
    fflush(stdout);
    int ret;
    scanf("%d", &ret);
    return ret;
}
int n, col[160], r=1;
int sum[160];
int main()
{
    scanf("%d", &n);
    col[1]=sum[1]=1;
    for(int i=2; i<=n; i++){
        sum[i]=query(1, i);
        if(sum[i-1]+1==sum[i]){
            col[i]=++r;
            continue;
        }
        else{
            int s=1, e=i-1;
            while(s<e){
                int mid=(s+e)/2;
                if(query(mid, i)==query(mid, i-1)+1)e=mid;
                else s=mid+1;
            }
            col[i]=col[s];
        }
    }
    printf("0 ");
    for(int i=1; i<=n; i++)printf("%d ", col[i]);
}

Compilation message

carnival.cpp: In function 'int query(int, int)':
carnival.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &ret);
     ~~~~~^~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 252 KB Output is correct
2 Incorrect 23 ms 248 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -