Submission #344020

#TimeUsernameProblemLanguageResultExecution timeMemory
344020amunduzbaevLibrary (JOI18_library)C++14
19 / 100
360 ms2028 KiB
#include "library.h" //#include "grader.cpp" /** made by amunduzbaev **/ #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define mp make_pair #define ub upper_bound #define lb lower_bound #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(),x.rend() #define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define vll vector<ll> #define vii vector<int> #define vpii vector<pii> #define vpll vector<pll> #define cnt(a)__builtin_popcount(a) template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;} template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;} const int N = 2e5+5; const int mod = 1e9+7; const ll inf = 1e18; const ld Pi = acos(-1); vector<int> m(N), used(N); void Solve(int n){ deque<int> ans; int l = 0; ans.push_back(l); m[l] = 1; used[l] = 1; m.resize(n); while(sz(ans) < n){ bool ok = 0; for(int j=0;j<n;j++){ if(used[j]) continue; m[j] = 1; //print(); int res = Query(m); if(res == 1){ used[j] = 1; ans.push_back(j); m[l] = 0; l = j; ok = 1; break; }else m[j] = 0; } if(!ok){ m[l] = 0; l = 0; m[l] = 1; break; } } while(sz(ans) < n){ for(int j=0;j<n;j++){ if(used[j]) continue; m[j] = 1; //print(); int res = Query(m); if(res == 1){ used[j] = 1; ans.push_front(j); m[l] = 0; l = j; break; }else m[j] = 0; } } vector<int> res; for(int i=0;i<n;i++){ int cur = ans.front(); res.pb(cur+1); ans.pop_front(); } Answer(res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...