답안 #129682

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129682 2019-07-13T03:41:33 Z BThero 도서관 (JOI18_library) C++17
19 / 100
2000 ms 376 KB
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include "library.h"

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;   
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int MAXN = (int)1e3 + 5;

bool used[MAXN];

void Solve(int n) {
    vector<int> vl, vr;
    int l = 0, r = 0;
    used[0] = 1;
    vl.pb(0);

    while (vl.size() + vr.size() < n) {
        for (int i = 0; i < n; ++i) {
            if (!used[i]) {
                vector<int> V(n, 0);
                V[l] = V[i] = 1;

                if (Query(V) == 1) {
                    vl.pb(i);
                    l = i;
                    used[i] = 1;
                    break;
                }
            }
        }

        for (int i = 0; i < n; ++i) {
            if (!used[i]) {
                vector<int> V(n, 0);
                V[r] = V[i] = 1;

                if (Query(V) == 1) {
                    vr.pb(i);
                    r = i;
                    used[i] = 1;
                    break;
                }
            }
        }
    }

    reverse(all(vl));
    vector<int> ret;

    for (int x : vl) {
        ret.pb(x + 1);
    }

    for (int x : vr) {
        ret.pb(x + 1);
    }

	Answer(ret);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:36:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (vl.size() + vr.size() < n) {
            ~~~~~~~~~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 154 ms 376 KB # of queries: 9254
2 Correct 214 ms 376 KB # of queries: 12162
3 Correct 155 ms 248 KB # of queries: 9292
4 Correct 223 ms 312 KB # of queries: 14657
5 Correct 169 ms 316 KB # of queries: 12880
6 Correct 202 ms 376 KB # of queries: 12739
7 Correct 177 ms 376 KB # of queries: 10676
8 Correct 236 ms 376 KB # of queries: 12126
9 Correct 299 ms 248 KB # of queries: 17932
10 Correct 53 ms 248 KB # of queries: 4015
11 Correct 2 ms 248 KB # of queries: 0
12 Correct 2 ms 376 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 2
14 Correct 2 ms 248 KB # of queries: 7
15 Correct 6 ms 376 KB # of queries: 166
16 Correct 6 ms 376 KB # of queries: 305
# 결과 실행 시간 메모리 Grader output
1 Correct 154 ms 376 KB # of queries: 9254
2 Correct 214 ms 376 KB # of queries: 12162
3 Correct 155 ms 248 KB # of queries: 9292
4 Correct 223 ms 312 KB # of queries: 14657
5 Correct 169 ms 316 KB # of queries: 12880
6 Correct 202 ms 376 KB # of queries: 12739
7 Correct 177 ms 376 KB # of queries: 10676
8 Correct 236 ms 376 KB # of queries: 12126
9 Correct 299 ms 248 KB # of queries: 17932
10 Correct 53 ms 248 KB # of queries: 4015
11 Correct 2 ms 248 KB # of queries: 0
12 Correct 2 ms 376 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 2
14 Correct 2 ms 248 KB # of queries: 7
15 Correct 6 ms 376 KB # of queries: 166
16 Correct 6 ms 376 KB # of queries: 305
17 Execution timed out 3024 ms 248 KB Time limit exceeded
18 Execution timed out 3095 ms 248 KB Time limit exceeded
19 Execution timed out 3055 ms 248 KB Time limit exceeded
20 Execution timed out 3065 ms 248 KB Time limit exceeded
21 Execution timed out 3070 ms 248 KB Time limit exceeded
22 Execution timed out 3047 ms 248 KB Time limit exceeded
23 Execution timed out 3061 ms 248 KB Time limit exceeded
24 Execution timed out 3015 ms 376 KB Time limit exceeded
25 Execution timed out 3029 ms 376 KB Time limit exceeded
26 Execution timed out 3089 ms 248 KB Time limit exceeded
27 Execution timed out 3051 ms 248 KB Time limit exceeded
28 Execution timed out 3040 ms 376 KB Time limit exceeded
29 Execution timed out 3035 ms 376 KB Time limit exceeded
30 Execution timed out 3071 ms 248 KB Time limit exceeded