# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
134404 |
2019-07-22T16:13:45 Z |
duality |
Library (JOI18_library) |
C++11 |
|
531 ms |
452 KB |
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "library.h"
void Solve(int N) {
if (N == 1) {
vi v;
v.pb(1);
Answer(v);
return;
}
int i;
vi M(N,1);
for (i = 0; i < N; i++) {
M[i] = 0;
if (Query(M) == 1) break;
else M[i] = 1;
}
vi ans,rem;
ans.pb(i);
for (i = 0; i < N; i++) {
if (i != ans.back()) rem.pb(i);
}
while (ans.size() < N) {
int l = 0,r = rem.size()-1;
while (l < r) {
int m = (l+r) / 2;
fill(M.begin(),M.end(),0);
for (i = l; i <= m; i++) M[rem[i]] = 1;
int x = Query(M);
M[ans.back()] = 1;
if (Query(M) == x) r = m;
else l = m+1;
}
ans.pb(rem[l]),rem[l] = rem.back(),rem.pop_back();
}
for (i = 0; i < ans.size(); i++) ans[i]++;
Answer(ans);
}
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:79:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (ans.size() < N) {
~~~~~~~~~~~^~~
library.cpp:92:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < ans.size(); i++) ans[i]++;
~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
248 KB |
# of queries: 2373 |
2 |
Correct |
37 ms |
316 KB |
# of queries: 2423 |
3 |
Correct |
45 ms |
376 KB |
# of queries: 2646 |
4 |
Correct |
42 ms |
248 KB |
# of queries: 2585 |
5 |
Correct |
39 ms |
248 KB |
# of queries: 2498 |
6 |
Correct |
49 ms |
376 KB |
# of queries: 2551 |
7 |
Correct |
45 ms |
248 KB |
# of queries: 2560 |
8 |
Correct |
39 ms |
248 KB |
# of queries: 2438 |
9 |
Correct |
41 ms |
376 KB |
# of queries: 2532 |
10 |
Correct |
31 ms |
376 KB |
# of queries: 1448 |
11 |
Correct |
2 ms |
376 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
376 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
376 KB |
# of queries: 4 |
14 |
Correct |
2 ms |
256 KB |
# of queries: 7 |
15 |
Correct |
3 ms |
376 KB |
# of queries: 77 |
16 |
Correct |
5 ms |
376 KB |
# of queries: 181 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
248 KB |
# of queries: 2373 |
2 |
Correct |
37 ms |
316 KB |
# of queries: 2423 |
3 |
Correct |
45 ms |
376 KB |
# of queries: 2646 |
4 |
Correct |
42 ms |
248 KB |
# of queries: 2585 |
5 |
Correct |
39 ms |
248 KB |
# of queries: 2498 |
6 |
Correct |
49 ms |
376 KB |
# of queries: 2551 |
7 |
Correct |
45 ms |
248 KB |
# of queries: 2560 |
8 |
Correct |
39 ms |
248 KB |
# of queries: 2438 |
9 |
Correct |
41 ms |
376 KB |
# of queries: 2532 |
10 |
Correct |
31 ms |
376 KB |
# of queries: 1448 |
11 |
Correct |
2 ms |
376 KB |
# of queries: 0 |
12 |
Correct |
2 ms |
376 KB |
# of queries: 1 |
13 |
Correct |
2 ms |
376 KB |
# of queries: 4 |
14 |
Correct |
2 ms |
256 KB |
# of queries: 7 |
15 |
Correct |
3 ms |
376 KB |
# of queries: 77 |
16 |
Correct |
5 ms |
376 KB |
# of queries: 181 |
17 |
Correct |
531 ms |
376 KB |
# of queries: 18026 |
18 |
Correct |
496 ms |
376 KB |
# of queries: 17253 |
19 |
Correct |
487 ms |
328 KB |
# of queries: 17399 |
20 |
Correct |
458 ms |
376 KB |
# of queries: 16293 |
21 |
Correct |
437 ms |
380 KB |
# of queries: 15320 |
22 |
Correct |
513 ms |
376 KB |
# of queries: 17661 |
23 |
Correct |
438 ms |
424 KB |
# of queries: 17232 |
24 |
Correct |
160 ms |
376 KB |
# of queries: 7877 |
25 |
Correct |
495 ms |
416 KB |
# of queries: 17052 |
26 |
Correct |
463 ms |
424 KB |
# of queries: 15989 |
27 |
Correct |
175 ms |
376 KB |
# of queries: 8000 |
28 |
Correct |
466 ms |
248 KB |
# of queries: 16581 |
29 |
Correct |
467 ms |
452 KB |
# of queries: 16533 |
30 |
Correct |
479 ms |
376 KB |
# of queries: 16581 |