# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28335 | 점수판에 아이디와 팀명이 같이 표기되니, 신중하게 적어주세요. (#68) | 1-Color Coloring (FXCUP2_coloring) | C++98 | 0 ms | 1124 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "coloring.h"
int next[101];
int prev[101];
int chk[101];
int n;
int list[101];
int findprev(int x, int *l, int n) {
int f=1, r=n;
while (f<r) {
int m = (f + r + 1) / 2;
for (int i = f; i < m; i++) Color(l[i]);
if(GetColor(x) == 0) r = m - 1;
else f = m;
}
return l[f];
}
void ColoringSame(int N){
n = N;
int x = 1;
chk[1] = 1;
for (int i = 1; i < n; i++) list[i] = i+1;
int s = n-1;
for (int i = 1; i <= 10 && i < n; i++) {
prev[x] = findprev(x, list, s);
next[prev[x]] = x;
x = prev[x];
chk[x] = 1;
int j;
for (j = 1; list[j] != x; j++);
for (; j < s; j++) list[j] = list[j + 1];
s--;
}
Color(1);
for (int i = 1; i <= N-29; i++) {
for (int j = 1; j <= N; j++) {
if (!chk[j]) Color(j);
}
}
while (x != 1) {
Color(x);
x = next[x];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |