Submission #122899

# Submission time Handle Problem Language Result Execution time Memory
122899 2019-06-29T13:42:11 Z Gustav Library (JOI18_library) C++14
0 / 100
237 ms 404 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 998244353;
#pragma GCC optimize("Ofast")
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())
 
int n;
vi found(1010);
 
/*
int Query(const std::vector<int>& M){
    cout << "Query: ";
    for(int i = 0; i < sz(M); i++) cout << M[i] << " ";
    cout << endl;
    int r;
    cin >> r;
    return r;
}
 
void Answer(const std::vector<int>& res)
{
    cout << "Answer: ";
    for(int i = 0; i < sz(res); i++) cout << res[i] << " ";
    cout << endl;
}
*/
 
int endcount(vi o){
    vi m(n);
    for(int i = 0; i < sz(o); i++){
        m[o[i]] = 1;
    }
    int r1 = Query(m);
    for(int i = 0; i < n; i++){
        if(m[i]) m[i] = 0;
        else if(!found[i]) m[i] = 1;
    }
    int r2 = Query(m);
    if(r1 == r2) return 1;
    if(r1+1 == r2) return 0;
    if(r1 == r2+1) return 2;
    assert(false);
    return -1;
}
 
int find(){
    vi left;
    for(int i = 0; i < n; i++){
        if(!found[i]) left.push_back(i);
    }
 
    int lo = 0, hi = sz(left);
    while(lo+1 < hi){
        cout << lo << " " << hi << endl;
        int mid = (lo+hi)/2;
        vi c;
        for(int i = 0; i < mid; i++){
            c.push_back(left[i]);
        }
        int r = endcount(c);
        if(r == 0) lo = mid;
        else hi = mid;
    }
    return left[lo];
}
 
void Solve(int N){
    n = N;
 
    vi start;
    vi end;
    start.push_back(find());
    found[start[0]] = 1;
    for(int i = 0; i < n-1; i++){
        int r = find();
        found[r] = 1;
        vi t(n);
        t[r] = 1;
        t[start[sz(start)-1]] = 1;
        if(Query(t) == 1) start.push_back(r);
        else end.push_back(r);
    }
    for(int i = sz(end)-1; i >= 0; i--){
        start.push_back(end[i]);
    }
    for(int i = 0; i < sz(start); i++) start[i]--;
    Answer(start);
}
 
/*
int main(){
    cin.sync_with_stdio(false);
    cin.tie(0);
 
    Solve(5);
}
*/
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
2 Incorrect 10 ms 252 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
3 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
4 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
5 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
6 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
7 Incorrect 11 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
8 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
9 Incorrect 11 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
10 Incorrect 6 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
11 Incorrect 2 ms 248 KB Wrong Answer [5]
12 Incorrect 2 ms 256 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
13 Incorrect 2 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
14 Incorrect 2 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
15 Incorrect 2 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
16 Incorrect 2 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
2 Incorrect 10 ms 252 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
3 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
4 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
5 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
6 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
7 Incorrect 11 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
8 Incorrect 11 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
9 Incorrect 11 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
10 Incorrect 6 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
11 Incorrect 2 ms 248 KB Wrong Answer [5]
12 Incorrect 2 ms 256 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
13 Incorrect 2 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
14 Incorrect 2 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
15 Incorrect 2 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
16 Incorrect 2 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
17 Incorrect 236 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
18 Incorrect 231 ms 376 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
19 Incorrect 237 ms 404 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
20 Incorrect 211 ms 336 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
21 Incorrect 187 ms 332 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
22 Incorrect 235 ms 332 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
23 Incorrect 234 ms 332 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
24 Incorrect 61 ms 336 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
25 Incorrect 225 ms 380 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
26 Incorrect 204 ms 332 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
27 Incorrect 62 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
28 Incorrect 235 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
29 Incorrect 234 ms 332 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT
30 Incorrect 235 ms 248 KB DO NOT WRITE ANYTHING TO STANDARD OUTPUT