Submission #153988

# Submission time Handle Problem Language Result Execution time Memory
153988 2019-09-17T16:20:07 Z karma Library (JOI18_library) C++14
0 / 100
561 ms 684 KB
#include<bits/stdc++.h>
#include "library.h"
#define pb      emplace_back
#define ll      long long

using namespace std;

const int N = int(2e3) + 7;

vector<int> m, ans, s;
int low, high, mid, sz, cur;

void Solve(int n) {
    if(n == 1) {Answer({1}); return;}
    m.resize(n, 1); s.resize(n);
    for(int i = 0; i < n; ++i) {
       m[i] = 0;
       if(Query(m) == 1) {cur = i; break;}
       m[i] = 1;
    }
    iota(s.begin(), s.end(), 0);
    ans.pb(cur + 1);
    s.erase(find(s.begin(), s.end(), cur));
    while(s.size() < n) {
       low = 0, high = s.size() - 1;
       while(low <= high) {
           mid = sz = (low + high) >> 1;
           fill(m.begin(), m.end(), 0);
           for(int x: s) {
              m[x] = 1;
              if(!sz) break;
              --sz;
           }
           int res = Query(m);
           m[cur] = 1;
           if(res == Query(m)) high = mid - 1;
           else low = mid + 1;
       }
       cur = s[low];
       ans.pb(cur + 1);
       s.erase(find(s.begin(), s.end(), cur));
    }
    Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:24:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(s.size() < n) {
           ~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 52 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 53 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 48 ms 656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 42 ms 680 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 45 ms 576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 42 ms 576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 49 ms 684 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 44 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 29 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Correct 2 ms 292 KB # of queries: 0
12 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 680 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 52 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 53 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 48 ms 656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 42 ms 680 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 45 ms 576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 42 ms 576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 49 ms 684 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 44 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 29 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Correct 2 ms 292 KB # of queries: 0
12 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 680 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 526 ms 460 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 561 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 534 ms 468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 467 ms 584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 438 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 515 ms 544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 540 ms 588 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 177 ms 588 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 534 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 470 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 189 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 463 ms 464 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 501 ms 460 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 479 ms 552 KB Execution killed with signal 11 (could be triggered by violating memory limits)