이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "squares.h"
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
vi labels_global(20000,0);
vi paint(int n) {
forn(i,labels_global.size()) {
labels_global[i] = -1;
}
vi labels(n + 1, 1);
int k = 0;
while ((pow(2,k)-1)+k < n) {
k++;
}
forn(i,k) {
labels_global[i] = 1;
}
vector<bool>visited(pow(2,k)+1, 0);
int val = pow(2,k)-1;
int sym;
visited[val] = true;
int i =0 ;
while (i+k < n) {
val = (val << 1) % (int)pow(2,k);
sym = 0;
if (visited[val]) {
val += 1;
sym = 1;
}
visited[val] = true;
labels[i+k] = sym;
labels_global[i+k] = sym;
i++;
}
labels[n] = k;
return labels;
}
int find_location(int n, vi c) {
return search(begin(labels_global), end(labels_global), begin(c), end(c)) - labels_global.begin();
}
# | 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... |