QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#312763 | #4832. Telepathy | Unknown1508 | 0 | 41ms | 7368kb | C++20 | 1.6kb | 2024-01-24 11:43:20 | 2024-01-24 11:43:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void main_program();
signed main(){
// ios_base::sync_with_stdio(0); cin.tie(0);
main_program();
}
mt19937_64 rng(12345);
int n, k;
string player, s;
const int BLOCKSIZE = 2;
const vector<string> allstr = {"00", "01", "10", "11"};
int solve_player1(string S){
vector<int> winning(BLOCKSIZE, 0);
for (auto T: allstr){
for (int choice = 0; choice < BLOCKSIZE; choice++){
for (int opp = 0; opp < BLOCKSIZE; opp++){
winning[choice] += (T[choice] == S[opp]);
}
}
}
int mx = *max_element(winning.begin(), winning.end());
for (int i = 0; i < BLOCKSIZE; i++){
if (winning[i] == mx) return i;
}
return 0;
}
int solve_player2(string S){
vector<int> winning(BLOCKSIZE, 0);
for (auto T: allstr){
int opp = solve_player1(T);
for (int choice = 0; choice < BLOCKSIZE; choice++){
if (T[choice] == S[opp]) winning[choice]++;
}
}
int mx = *max_element(winning.begin(), winning.end());
for (int i = 0; i < BLOCKSIZE; i++){
if (winning[i] == mx) return i;
}
return 0;
}
void main_program(){
cin >> player >> n >> k >> s;
vector<int> blocks;
for (int i = 0; i < n; i += BLOCKSIZE){
blocks.push_back(i);
}
shuffle(blocks.begin(), blocks.end(), rng);
blocks.resize(k);
sort(blocks.begin(), blocks.end());
vector<int> lst;
for (auto i: blocks){
if (player == "Flim") lst.push_back(i + solve_player1(s.substr(i, BLOCKSIZE)));
else lst.push_back(i + solve_player2(s.substr(i, BLOCKSIZE)));
}
for (int i = 0; i < k; i++){
cout << lst[i] + 1 << " \n"[i == k-1];
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 41ms
memory: 7368kb
input:
Flim 1000000 100000 1101111111100010011110111001110011110110100000111110011111111111110111110100000001001000000110111000000101110000001100111110100100000100010111001011111010001000101100101100001111011100110010010000100100100101110100100110101001001000001011111101111111001100101000010110001011011000...
output:
1 3 17 27 37 41 83 125 131 137 145 147 155 157 167 173 187 203 205 211 231 235 237 249 257 273 283 285 305 317 333 339 357 359 369 377 381 385 393 401 409 413 417 423 431 433 437 447 449 455 457 459 461 469 475 481 511 547 553 559 565 569 571 595 603 607 615 629 655 659 671 713 725 727 729 757 767 7...
input:
Flam 1000000 100000 0000001101000100010010001001011111000101010011011001010100101001110101001011001011100001011100110100011110011010100101110101101101100101111011000111001101001100010000010010101110101010111110001100110000110001001111010010000010111101110001011011101101010000111111011111100100010001...
output:
1 3 17 27 37 41 83 125 131 137 145 147 155 157 167 173 187 203 205 211 231 235 237 249 257 273 283 285 305 317 333 339 357 359 369 377 381 385 393 401 409 413 417 423 431 433 437 447 449 455 457 459 461 469 475 481 511 547 553 559 565 569 571 595 603 607 615 629 655 659 671 713 725 727 729 757 767 7...
result:
wrong answer 49795 matched, but you need to match at least 66666 positions