题面
来源:FrontierCS 官方 statement.txt,与模型收到的题面相同。
time limit per test: 0.25 second
memory limit per test: 512 megabytes
This is an interactive problem.
You have 𝑅 vacuum cleaner robots left over from your trade with your fellow contestants. You want to use these robots to locate the two chairmen. You can instruct each robot to scout several of 1000 positions where the chairmen could be located.
Each robot can only detect whether or not there is at least one chairman at its scouted positions. Every robot needs a full hour to scout its positions before returning with its result to you. Because this will drain the robot’s battery, you can send out each robot only once.
You want to know the positions of the chairmen after at most 𝐻 hours. In particular, you might be forced to send out several robots at once without waiting for the previous robots to return. You can assume that the two chairmen stay at the same positions all the time.
Write a program which plans this scouting mission and determines where the two chairmen are located.
Input
The first line consists of 2 integers R and H (R=75,H=1), indicating the number of vacuum cleaner robots and the number of hours.
Interaction
To send a robot to scout the positions, print on a single line "? k, 𝑃[0],…,𝑃[𝑘 − 1]" (where 𝑘 is the length of the array 𝑃). The positions 𝑃[𝑖] must be pairwise distinct integers between 1 and 1000. You can 'send' at most 𝑅 times per testcase.
To get the answers of robot that sent before, print on a single line '@', then you will receive an integer L and a array (with length L) with exactly one entry for each robot sent out one hour ago (by a 'send' after the previous 'get' to wait or after the beginning of the program). The entry at index 𝑖 is 1 if the (𝑖 +1)-th of these robots has detected at least one chairman at its scouted positions, and 0 otherwise. You can 'get' at most 𝐻 times per testcase.
Once you have figured out the positions, print '!' followed by 2 integers a and b (1 ≤ 𝑎,𝑏 ≤ 1000, 𝑎 = 𝑏 is allowed), representing the positions of the two chairmen.
After printing a query do not forget to output the end of line and flush the output. Use fflush(stdout) or cout.flush() to flush.
Example
Consider a testcase with 𝑅 = 75 and 𝐻 = 20 where the chairmen are located at positions 13 and 37.
First, the grader calls your function scout as scout(75,20). Then, an interaction between your program and the grader could look as follows:
Your program | read | Explanation
? 3 42 13 37 | none | send a robot to positions 13, 37 and 42
? 2 47 11 | none |send a robot to positions 13, 37 and 42
@ | 2 1 0|wait an hour for the return of two robots; only the first robot has detected a chairman
? 1 42 | none |send a robot to position 42
@ | 1 0 |wait an hour; there is no chairman at position 42 you are convinced that the chairmen are located
! 13 37 | none |you are convinced that the chairmen are located at positions 13 and 37
Returning the pair {37,13} would be accepted as well.
Note that the above queries are of course not sufficient to determine the positions of the chairmen with certainty: For example, both being at position 37 or one chairman being at position 13 while the other is at position 100 would also be consistent with all answers to wait, so the grader could also have rejected this solution.
Moreover, the grader is adaptive, i.e. the positions of the chairmen may depend on the behavior of your program in the current as well as in earlier runs.
## Scoring
All feasibility and interaction limits apply before scoring; invalid output receives zero. Points are averaged over test files. For the logarithmic branch, write x for the original minimizing quantity and a for its physical 60-point reference. The improvement factor is r=a/x, and the upper-band award is P=min(100,60+ln(r)). Here ln is natural: r=1 corresponds to 60 points, and on the uncapped logarithmic upper band, r=exp(P-60). Each additional point multiplies the physical improvement factor by e (divides a minimizing objective by e or multiplies a maximizing objective by e, as applicable). The lower-band, zero-objective, and completion rules below still apply.
Q is the number of robots sent. Define h=(820-20*Q)/300 for Q<=30, (580-12*Q)/300 for 30<Q<=35, (440-8*Q)/300 for 35<Q<=40, (280-4*Q)/300 for 40<Q<=60, and 2/15 for 60<Q<=75. Define the objective x=Q, its physical reference a=A=26, and the lower-band calculation L=60*h.
```text
P = 100, if x = 0
P = L, if L <= 60 and x > 0
P = min(100, 60 + ln(r)), otherwise
```
Zero is tested on the valid original count, cost, or error, before the lower-band test. A zero reference anchor has no positive improvement branch; positive objectives keep their lower-band score. The checker reports P/100.
结果
Kimi K3.1 ProKimi
max
32.0
平均得分 ↑
- 32.0采样 1 · 部分分
- 56.5k平均输出 token(含思考) ↓
- 27.4输出速度 tokens/s ↑
- 2061 秒延迟 ↓
Kimi K3.1 Pro(high)Kimi high
high
16.8
平均得分 ↑
- 16.8采样 1 · 部分分
- 17.6k平均输出 token(含思考) ↓
- 25.6输出速度 tokens/s ↑
- 690 秒延迟 ↓
DeepSeek Flash V4.1-1017DeepSeek
auto(high)
0.0
平均得分 ↑
- 0.0采样 1 · 无代码
- 14.9k平均输出 token(含思考) ↓
- 182.4输出速度 tokens/s ↑
- 82 秒延迟 ↓
MiniMax M3.1 FlashMiniMax
auto(max)
0.0
平均得分 ↑
- 0.0采样 1 · 超时
- 158.3k平均输出 token(含思考) ↓
- 145.6输出速度 tokens/s ↑
- 1088 秒延迟 ↓
↑ 越大越好,↓ 越小越好。得分 0–100,按官方时限判定,所有测试点都满分才算解出。CPU 时间 / 官方解为解出的答案在官方解最慢的 3 个测试点上的 CPU 时间之比(几何平均),只比较官方解至少需要 0.05 秒的题;复杂度按增长幂次相对官方解分类。判题与计分见 原理。
代码
Kimi K3.1 Pro · 采样 1 · 137 行
#include <bits/stdc++.h> using namespace std; static inline uint64_t mix64(uint64_t x) { x += 0x9e3779b97f4a7c15ULL; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL; x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL; return x ^ (x >> 31); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int R, H; if (!(cin >> R >> H)) return 0; const auto startTime = chrono::steady_clock::now(); vector<uint64_t> code; code.reserve(1000); vector<vector<int>> positions(49); for (int id = 0; id < 2401 && (int)code.size() < 1000; ++id) { int c[4], t = id; for (int j = 0; j < 4; ++j) { c[j] = t % 7; t /= 7; } int val[7]; bool ok = true; for (int x = 0; x < 7; ++x) { int v = c[3]; v = (v * x + c[2]) % 7; v = (v * x + c[1]) % 7; v = (v * x + c[0]) % 7; val[x] = v; if (x < 5 && v == 0) ok = false; } if (!ok) continue; int pos = (int)code.size() + 1; uint64_t mask = 0; for (int x = 0; x < 7; ++x) { int bit = x * 7 + val[x]; mask |= 1ULL << bit; positions[bit].push_back(pos); } code.push_back(mask); } const int N = (int)code.size(); vector<uint64_t> unions; unions.reserve(N * (N + 1) / 2); for (int i = 0; i < N; ++i) for (int j = i; j < N; ++j) unions.push_back(code[i] | code[j]); uint64_t currentMask = 0; for (uint64_t c : code) currentMask |= c; vector<int> order; for (int s = 0; s < 7; ++s) for (int b = 0; b < 7; ++b) { int bit = b * 7 + s; if ((currentMask >> bit) & 1ULL) order.push_back(bit); } const int HS = 1 << 20; vector<uint64_t> keys(HS); vector<uint32_t> tags(HS, 0); uint32_t stamp = 0; auto uniqueForMask = [&](uint64_t mask) { ++stamp; for (uint64_t full : unions) { uint64_t key = full & mask; int h = (int)(mix64(key) & (HS - 1)); while (tags[h] == stamp) { if (keys[h] == key) return false; h = (h + 1) & (HS - 1); } tags[h] = stamp; keys[h] = key; } return true; }; for (int bit : order) { if (__builtin_popcountll(currentMask) <= 26) break; double elapsed = chrono::duration<double>( chrono::steady_clock::now() - startTime).count(); if (elapsed > 0.10) break; uint64_t candidate = currentMask & ~(1ULL << bit); if (uniqueForMask(candidate)) currentMask = candidate; } vector<int> sentBits; for (int bit = 0; bit < 49; ++bit) if ((currentMask >> bit) & 1ULL) sentBits.push_back(bit); for (int bit : sentBits) { const auto &v = positions[bit]; cout << "? " << v.size(); for (int p : v) cout << ' ' << p; cout << '\n'; cout.flush(); } cout << "@\n"; cout.flush(); int L; cin >> L; uint64_t answer = 0; for (int i = 0; i < L; ++i) { int x; cin >> x; if (x && i < (int)sentBits.size()) answer |= 1ULL << sentBits[i]; } for (int i = 0; i < N; ++i) { for (int j = i; j < N; ++j) { if (((code[i] | code[j]) & currentMask) == answer) { cout << "! " << i + 1 << ' ' << j + 1 << '\n'; cout.flush(); return 0; } } } return 0; }
Kimi K3.1 Pro(high) · 采样 1 · 81 行
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int R, H; cin >> R >> H; static int value[1000][7]; for (int id = 0; id < 1000; ++id) { int coef[4]; int x = id; for (int i = 0; i < 4; ++i) { coef[i] = x % 7; x /= 7; } for (int point = 0; point < 7; ++point) { int cur = 0; int power = 1; for (int i = 0; i < 4; ++i) { cur = (cur + coef[i] * power) % 7; power = (power * point) % 7; } value[id][point] = cur; } } for (int point = 0; point < 7; ++point) { for (int symbol = 0; symbol < 7; ++symbol) { vector<int> positions; for (int id = 0; id < 1000; ++id) { if (value[id][point] == symbol) { positions.push_back(id + 1); } } cout << "? " << positions.size(); for (int p : positions) { cout << ' ' << p; } cout << '\n'; cout.flush(); } } cout << "@\n"; cout.flush(); int L; cin >> L; vector<int> answer(L); for (int &x : answer) { cin >> x; } vector<int> candidates; for (int id = 0; id < 1000; ++id) { bool ok = true; for (int point = 0; point < 7; ++point) { int symbol = value[id][point]; if (!answer[point * 7 + symbol]) { ok = false; break; } } if (ok) { candidates.push_back(id + 1); } } int a = candidates[0]; int b = candidates.size() == 1 ? candidates[0] : candidates[1]; cout << "! " << a << ' ' << b << '\n'; cout.flush(); return 0; }
没有代码:回答中没有代码块。
MiniMax M3.1 Flash · 采样 1 · 222 行
#include <bits/stdc++.h> using namespace std; static constexpr int N = 1000; static constexpr int BITS = 10; static constexpr int LIMIT = (1 << BITS) - 1; /* For two labels a and b, let d = a XOR b and D = support(d). After querying both the zero-set and the one-set of every bit, we know the unordered pair of bits at each position. The only remaining ambiguity is that, independently at every bit in D, the two labels may be swapped. For a parity mask t, querying positions for which parity(label & t) is 1 distinguishes such a swap at a nonempty proper subset S of D exactly when parity(t & D) = 0 and parity(t & S) = 1. The following routine constructs a small family of parity masks hitting every possible pair (D, S). */ static vector<int> buildHittingSet() { constexpr int MASKS = 1 << BITS; constexpr int WORDS = MASKS / 64; int constraintCount = 0; for (int d = 1; d <= LIMIT; ++d) { constraintCount += (1 << __builtin_popcount((unsigned)d)) - 2; } vector<uint64_t> rows((size_t)constraintCount * WORDS, 0); vector<int> gain(MASKS, 0); int index = 0; for (int d = 1; d <= LIMIT; ++d) { for (int s = (d - 1) & d; s; s = (s - 1) & d) { uint64_t *row = rows.data() + (size_t)index * WORDS; int p = s & -s; int difference = d ^ s; int q = difference & -difference; int freeMask = LIMIT ^ (p | q); int u = freeMask; while (true) { int parityS = __builtin_parity( (unsigned)(u & (s ^ p)) ); int parityDifference = __builtin_parity( (unsigned)(u & (difference ^ q)) ); int valueP = 1 ^ parityS; int valueQ = 1 ^ parityDifference; int t = u; if (valueP) t |= p; if (valueQ) t |= q; row[t >> 6] |= 1ULL << (t & 63); ++gain[t]; if (u == 0) break; u = (u - 1) & freeMask; } ++index; } } vector<unsigned char> covered(constraintCount, 0); vector<int> selected; int remaining = constraintCount; while (remaining > 0 && selected.size() < 45) { int best = -1; for (int t = 0; t < MASKS; ++t) { if (best == -1 || gain[t] > gain[best]) best = t; } if (best == -1 || gain[best] == 0) break; selected.push_back(best); for (int i = 0; i < constraintCount; ++i) { if (covered[i]) continue; const uint64_t *row = rows.data() + (size_t)i * WORDS; if (!(row[best >> 6] & (1ULL << (best & 63)))) continue; covered[i] = 1; --remaining; for (int w = 0; w < WORDS; ++w) { uint64_t values = row[w]; while (values) { int bit = __builtin_ctzll(values); values &= values - 1; --gain[(w << 6) | bit]; } } } } if (remaining == 0 && selected.size() <= 45) { sort(selected.begin(), selected.end()); return selected; } // Every pair (D, S) is hit by a mask {i,j} with i in S and j in D\S. vector<int> fallback; for (int i = 0; i < BITS; ++i) { for (int j = i + 1; j < BITS; ++j) { fallback.push_back((1 << i) | (1 << j)); } } return fallback; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int R, H; if (!(cin >> R >> H)) return 0; vector<int> parityMasks = buildHittingSet(); vector<uint16_t> valueMask(N), zeroMask(N); vector<uint64_t> checksumMask(N, 0); for (int label = 0; label < N; ++label) { uint16_t ones = 0; for (int bit = 0; bit < BITS; ++bit) { if ((label >> bit) & 1) ones |= uint16_t(1 << bit); } valueMask[label] = ones; zeroMask[label] = uint16_t(LIMIT ^ ones); for (int j = 0; j < (int)parityMasks.size(); ++j) { if (__builtin_parity((unsigned)(label & parityMasks[j]))) { checksumMask[label] |= 1ULL << j; } } } vector<vector<int>> queries; queries.reserve(20 + parityMasks.size()); for (int bit = 0; bit < BITS; ++bit) { vector<int> zeros, ones; for (int position = 0; position < N; ++position) { if ((position >> bit) & 1) { ones.push_back(position + 1); } else { zeros.push_back(position + 1); } } queries.push_back(move(zeros)); queries.push_back(move(ones)); } for (int t : parityMasks) { vector<int> positions; for (int position = 0; position < N; ++position) { if (__builtin_parity((unsigned)(position & t))) { positions.push_back(position + 1); } } queries.push_back(move(positions)); } for (const auto &query : queries) { cout << "? " << query.size(); for (int position : query) cout << ' ' << position; cout << endl; } cout << "@" << endl; int returned; if (!(cin >> returned)) return 0; vector<int> response(returned); for (int &answer : response) { if (!(cin >> answer)) return 0; } int required = 20 + (int)parityMasks.size(); if (returned < required) return 0; uint16_t observedOnes = 0; uint16_t observedZeros = 0; for (int bit = 0; bit < BITS; ++bit) { if (response[2 * bit]) observedOnes |= uint16_t(1 << bit); if (response[2 * bit + 1]) observedZeros |= uint16_t(1 << bit); } uint64_t observedChecksum = 0; for (int j = 0; j < (int)parityMasks.size(); ++j) { if (response[20 + j]) observedChecksum |= 1ULL << j; } int answerA = -1, answerB = -1; for (int a = 0; a < N && answerA == -1; ++a) { for (int b = a; b < N; ++b) { if ((valueMask[a] | valueMask[b]) != observedOnes) continue; if ((zeroMask[a] | zeroMask[b]) != observedZeros) continue; if ((checksumMask[a] | checksumMask[b]) != observedChecksum) continue; answerA = a + 1; answerB = b + 1; break; } } if (answerA == -1) return 0; cout << "! " << answerA << ' ' << answerB << endl; return 0; }