Submission #1132060

#TimeUsernameProblemLanguageResultExecution timeMemory
1132060Wendidiask도서관 (JOI18_library)C++20
0 / 100
99 ms420 KiB
/* :---:--:--::::::--:-:----: ::-:::. ::-::: .* -===.. :--- .-+*##=-------====-: :--: :+##=.* -= :=+- .-=: .+++-. :- -=. .=+- .--. .++=- + -= :*- :-. +*+- :- -=. -*: :=: #*: * -=. +- .= =:%+ -: -=. +- -- -%: * -=. *: +. :%-.. =. -=. # -: :=# .. + -=. == -= ---+ . = -=. .# .+ -: == . = :------::------:.-=. % .= :- == .=. ---:. :--#+. .% :- = .* .+.. :=- :++ -+ =: + #. + -=: :*%-*: * := :# :=:= . :-----: =+-+ .+ * -* *=- . .- :::::::. :* .#+. + :- -+ :#. --::-----: :* ++= .- + :*. *. .:::::*%: ++ +.-=. + + -#**----: .= -*. + -= = * +.#=+: + . .=+: =. -=. = = -+ :++: + .. .=+= .= -=. - = %- :====-:. =. .:--===- * -=. - + +-- .:--==#==-:.= + -=. = * + * =. : .= -=. = + = * + = -=. + :- = .= =: = -=. .- * + =: * * -=. + :- .+ =- :- .+ -=. .+ * * := * := -= * = :- =: .- .=: -=. =: -: * .=- + .=- -= :- =: -: --: :- :--: -=. .= =:+ ----. * :---. -= .+ --=*----------------------=*+=--=+--=+*+------------------------------------------------%+:. :: := +:- -- :. .=. =. -= -= .=: .=. .=: .+: :-- :-: -- -=. :--. --: :--: .--: .-:-: ::--. :----. .:---- .:::::::::-::::::--::::::::. */ // Hello this is Tyx2019's clone #include "library.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define debug(x) cerr << #x << " is " << x << "\n" #define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define rep(i, a, b) for (int i = a; i <= b; i++) #define repb(i, a, b) for (int i = b; i >= a; i--) #define pii pair<int, int> #define linebreak cout << "---------------------------------------------------------\n" #define f first #define s second #define pb push_back #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") // good luck const int MS = 1005, mod = 1e9+9, INF = INT_MAX, blk = 400; int vis[MS]; void Solve(int n) { vector<int> v, ans; if (n == 1) { ans.pb(1); Answer(ans); return; } int last = -1; for (int i = 0; i < n; i++) {v.pb(1); vis[i] = 0;} for (int i = 0; i < n; i++) { v[i] = 0; if (Query(v) == 1) {ans.pb(i+1); vis[i] = 1; last = i; break;} v[i] = 1; } //debug(last+1); // determined first element for (int i = 1; i < n; i++) { vector<int> res; for (int j = 0; j < n; j++) { if (!vis[j]) res.pb(1); else res.pb(0); } //for (auto it : res) cout << it << " "; //cout << '\n'; int low = 0, high = n-1; while (low < high) { int mid = (low+high)>>1; vector<int> templ = res; for (int j = 0; j < n; j++) { if (low <= j and j <= mid) continue; templ[j] = 0; } int prev = 0; for (int j = 0; j < n; j++) if (templ[j] == 1) { prev = Query(templ); } templ[last] = 1; int next = Query(templ); //cout << low << " " << mid << ": "; //for (auto it : templ) cout << it << " "; //debug(prev); debug(next); //cout << '\n'; if (prev >= next) high = mid; else low = mid+1; } //debug(low+1); vis[low] = 1; ans.pb(low+1); last = low; } Answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...