제출 #129682

#제출 시각아이디문제언어결과실행 시간메모리
129682BThero도서관 (JOI18_library)C++17
19 / 100
3095 ms376 KiB
// 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);
}

컴파일 시 표준 에러 (stderr) 메시지

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) {
            ~~~~~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...