제출 #125071

#제출 시각아이디문제언어결과실행 시간메모리
125071TuGSGeReL자동 인형 (IOI18_doll)C++17
84 / 100
148 ms8144 KiB
#include "doll.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define mp make_pair #define pub push_back #define pob pop_back() #define ss second #define ff first #define mt make_tuple #define pof pop_front() #define fbo find_by_order #define ook order_of_key #define lb lower_bound #define ub upper_bound typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; using pll = pair <ll, ll>; using pii = pair <int, int>; int st[300001], n, k = 1, cnt, cur = 1; vector<int> X, Y, C; void solve(int res, int num, int at) { if ( num == 1 ) { if ( res != 2 ) X[-at - 1] = -1; } else { if ( res <= num ) X[-at - 1] = -1; else X[-at - 1] = -(++cur); Y[-at - 1] = -(++cur); if ( res > num ) { solve(res - num, num / 2, X[-at - 1]); solve(num, num / 2, Y[-at - 1]); } else{ solve(res, num / 2, Y[-at - 1]); } } } void dfs(int u, int j ) { if ( !st[- u - 1] ) { if ( X[- u - 1] == 0 ) { X[- u - 1] = j; st[- u - 1] = 1; } else { st[- u - 1] = 1; dfs(X[- u - 1], j); } } else { if ( Y[- u - 1] == 0 ) { Y[- u - 1] = j; st[- u - 1] = 0; } else { st[- u - 1] = 0; dfs(Y[- u - 1], j); } } } void create_circuit(int M, vector<int> A) { n = A.size(); C.pub(A[0]); for (int i = 1; i <= M; i++) C.pub(-1); if ( n == 1 ) { for (int i = 1; i <= M; i++) C[i] = 0; answer(C, X, Y); } X.resize(n + log2(n)); Y.resize(n + log2(n)); while ( k < n ) k *= 2; solve(n, k / 2, -1); for (int i = 1; i < A.size(); i++) dfs(-1, A[i]); answer(C, X, Y); }

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

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:101:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  101 |  for (int i = 1; i < A.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...