제출 #416964

#제출 시각아이디문제언어결과실행 시간메모리
416964wiwiho자동 인형 (IOI18_doll)C++14
47 / 100
144 ms9632 KiB
#include "doll.h" #include <bits/stdc++.h> #include <bits/extc++.h> #define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define iter(a) a.begin(), a.end() #define riter(a) a.rbegin(), a.rend() #define lsort(a) sort(iter(a)) #define gsort(a) sort(riter(a)) #define pb(a) push_back(a) #define eb(a) emplace_back(a) #define pf(a) push_front(a) #define ef(a) emplace_front(a) #define pob pop_back() #define pof pop_front() #define mp(a, b) make_pair(a, b) #define F first #define S second #define mt make_tuple #define gt(t, i) get<i>(t) #define tomax(a, b) ((a) = max((a), (b))) #define tomin(a, b) ((a) = min((a), (b))) #define topos(a) ((a) = (((a) % MOD + MOD) % MOD)) #define uni(a) a.resize(unique(iter(a)) - a.begin()) #define printv(a, b) {bool pvaspace=false; \ for(auto pva : a){ \ if(pvaspace) b << " "; pvaspace=true;\ b << pva;\ }\ b << "\n";} using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef unsigned long long ull; typedef long double ld; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<ld, ld>; using tiii = tuple<int, int, int>; const ll MOD = 1000000007; const ll MAX = 2147483647; template<typename A, typename B> ostream& operator<<(ostream& o, pair<A, B> p){ return o << '(' << p.F << ',' << p.S << ')'; } ll ifloor(ll a, ll b){ if(b < 0) a *= -1, b *= -1; if(a < 0) return (a - b + 1) / b; else return a / b; } ll iceil(ll a, ll b){ if(b < 0) a *= -1, b *= -1; if(a > 0) return (a + b - 1) / b; else return a / b; } vector<int> x(1, MAX), y(1, MAX); vector<int> a; int ts = -1; int n; int dfs(int id, int cnt, int num, int go){ if((1 << cnt) > n - 1) return go; if(id == MAX){ id = --ts; x.eb(MAX); y.eb(MAX); } if(1 << cnt & num){ int tmp = dfs(y[-id - 1], cnt + 1, num, go); y[-id - 1] = tmp; } else{ int tmp = dfs(x[-id - 1], cnt + 1, num, go); x[-id - 1] = tmp; } return id; } void create_circuit(int m, vector<int> _a){ a = _a; vector<int> c(m + 1, -1); c[0] = a[0]; a.erase(a.begin()); a.eb(0); n = a.size(); for(int i = 0; i < n - 1; i++){ dfs(-1, 0, i, a[i]); } dfs(-1, 0, (1 << (__lg(n - 1) + 1)) - 1, 0); // printv(x, cerr); // printv(y, cerr); // printv(c, cerr); for(int i = 0; i < x.size(); i++){ if(x[i] == MAX) x[i] = -1; if(y[i] == MAX) y[i] = -1; } answer(c, x, y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:104:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |     for(int i = 0; i < x.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...