제출 #313133

#제출 시각아이디문제언어결과실행 시간메모리
313133vivaan_gupta도서관 (JOI18_library)C++14
19 / 100
278 ms632 KiB
#include <bits/stdc++.h> #include "library.h" using namespace std; using ll = long long; using ld = long double; using db = double; using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vpi = vector<pi>; using vpl = vector<pl>; using vpd = vector<pd>; // pairs #define mp make_pair #define f first #define s second // vectors #define sz(x) (int)(x).size() #define all(x) begin(x), end(x) #define rall(x) (x).rbegin(), (x).rend() #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pf push_front #define pb push_back #define eb emplace_back #define lb lower_bound #define ub upper_bound // loops #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) vi x[205]; bool done[205][205]; void Solve(int n){ if(n == 1){ vi a; a.pb(1); Answer(a); return; } vi a(n,-1); for(int i =0;i<n;i++){ vi lol; for(int j =0;j<n;j++){ if(j == i) continue; vi v(n,0); v[i] = 1; v[j] = 1; if(done[i][j]) continue; done[i][j]=true; done[j][i]=true; if(Query(v) == 1) lol.pb(j); } trav(b,lol){x[i].pb(b);x[b].pb(i);} } int st=-1,en=-1; for(int i =0;i<n;i++){ if(sz(x[i]) == 1){ if(st == -1) st = i; else en = i; } } set<int> vis; a[0] = st; vis.ins(st); for(int i =1;i<n;i++){ for(auto j:x[a[i-1]]){ if(vis.count(j) == 0){ a[i] = j; vis.ins(j); break; } } } for(int i =0;i<n;i++) a[i] ++; Answer(a); } /* stuff you should look for * read the probem 3 more times in case of WA :) * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH */

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

library.cpp: In function 'void Solve(int)':
library.cpp:76:12: warning: variable 'en' set but not used [-Wunused-but-set-variable]
   76 |  int st=-1,en=-1;
      |            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...