이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "doll.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
const int MOD = 1e9 + 7;
vector<pair<int, int>> res; int D = 1;
int R[500005];
int solve(vector<int> V, int N) {
bool ok = 1;
for(int l = 1; l < V.size(); l++)
ok &= (V[l] == V[l - 1]);
if(ok) return V[0];
int v = D++, i = 0, k = res.size();
vector<int> X, Y; res.push_back({-1, -1});
while(i < V.size()) {
X.push_back(V[i++]);
Y.push_back(V[i++]);
}
res[k] = {solve(X, N / 2), solve(Y, N / 2)};
return -v;
}
void create_circuit(int M, vector<int> A) {
A.push_back(0); int N = A.size(), S = 1, K = 0;
while(S < N) S *= 2, K++;
vector<int> B(S, 0);
for(int l = 0; l < S; l++) {
R[l] = ((R[l >> 1] >> 1) | ((l & 1) << (K - 1)));
if(l < S - N) B[R[l]] = -1;
}
int i = 0;
for(int l = 0; l < S; l++) {
if(B[l] == -1) continue;
B[l] = A[i++];
}
solve(B, S); vector<int> C, X, Y;
for(int l = 0; l <= M; l++)
C.push_back(-1);
for(int l = 0; l < res.size(); l++)
X.push_back(res[l].ff),
Y.push_back(res[l].ss);
answer(C, X, Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'int solve(std::vector<int>, int)':
doll.cpp:26:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for(int l = 1; l < V.size(); l++)
| ~~^~~~~~~~~~
doll.cpp:31:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | while(i < V.size()) {
| ~~^~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:54:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(int l = 0; l < res.size(); l++)
| ~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |