# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1053053 | 2024-08-11T08:16:14 Z | j_vdd16 | Super Dango Maker (JOI22_dango3) | C++17 | 1985 ms | 848 KB |
#include <algorithm> #include <bitset> #include <cstdint> #include <cstring> #include <iostream> #include <limits.h> #include <math.h> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define loop(X, N) for(int X = 0; X < (N); X++) #define all(V) V.begin(), V.end() #define rall(V) V.rbegin(), V.rend() using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<vector<ii>> vvii; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; #include "dango3.h" void Solve(int n, int m) { int colorCount = 1; vi color(n * m); color[0] = 0; vvi byColor(n); byColor[0].push_back(0); for (int i = 1; i < n * m; i++) { vi y; for (int j = i + 1; j < n * m; j++) y.push_back(j + 1); loop(j, colorCount) { for (int k = 1; k < byColor[j].size(); k++) { y.push_back(byColor[j][k] + 1); } } int res; if (colorCount <= n) res = Query(y); else res = 0; if (res == m - 1) { color[i] = colorCount; byColor[colorCount].push_back(i); colorCount++; } else { vi relevantColors, irrelevantColors; loop(j, colorCount) { if (byColor[j].size() < m) { relevantColors.push_back(j); } else { irrelevantColors.push_back(j); } } int l = 0, r = relevantColors.size() - 1; while (l < r) { int middle = (l + r) / 2; vi x; for (int j = i + 1; j < n * m; j++) x.push_back(j + 1); for (int j : irrelevantColors) { for (int idx : byColor[j]) { x.push_back(idx + 1); } } loop(j, relevantColors.size()) { int k = 0; if (l <= j && j <= middle) k++; int curColor = relevantColors[j]; for (; k < byColor[curColor].size(); k++) { x.push_back(byColor[curColor][k] + 1); } } res = Query(x); if (res == m - 1) { l = middle + 1; } else { r = middle; } } int curColor = relevantColors[l]; color[i] = curColor; byColor[curColor].push_back(i); } } loop(i, m) { vi x; loop(j, n) { x.push_back(byColor[j][i] + 1); } Answer(x); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 600 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 604 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 348 KB | Output is correct |
2 | Correct | 17 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 348 KB | Output is correct |
4 | Correct | 7 ms | 364 KB | Output is correct |
5 | Correct | 17 ms | 348 KB | Output is correct |
6 | Correct | 17 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 647 ms | 664 KB | Output is correct |
2 | Correct | 654 ms | 660 KB | Output is correct |
3 | Correct | 312 ms | 600 KB | Output is correct |
4 | Correct | 323 ms | 848 KB | Output is correct |
5 | Correct | 701 ms | 664 KB | Output is correct |
6 | Correct | 641 ms | 652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1985 ms | 832 KB | Wrong Answer [3] |
2 | Halted | 0 ms | 0 KB | - |