QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#322147 | #4675. Multiple Communications | duongnc000 | 0 | 0ms | 0kb | C++20 | 2.5kb | 2024-02-06 12:35:31 | 2024-02-06 12:35:31 |
answer
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;
const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const i64 oo = 1e18;
mt19937_64 rng(177013);
i64 rand_range(i64 l, i64 r) {
return rng() % (r - l + 1) + 1;
}
string name;
int val[1005], a[1005], b[1005];
map<int, vector<pair<int, int>>> mp;
void prep() {
for (int i = 0; i < 1000; ++i) val[i] = rng() & ((1 << 30) - 1);
}
void cook() {
for (int i = 1; i <= 100; ++i) {
string s; cin >> s; int res = 0;
for (char ch : s) res ^= ch == '1' ? val[i] : 0;
cout << res;
}
}
void eat() {
string aa, bb;
cin >> aa >> bb;
for (int i = 0; i < 3000; i += 30) {
int tmp = 0;
for (int j = 0; j < 30; ++j)
tmp = tmp << 1 | (aa[i + j] - '0');
a[i / 30] = tmp;
}
for (int i = 0; i < 3000; i += 30) {
int tmp = 0;
for (int j = 0; j < 30; ++j)
tmp = tmp << 1 | (bb[i + j] - '0');
b[i / 30] = tmp;
}
for (int i = 0; i < 100; ++i) for (int j = 0; j < 100; ++j) {
mp[a[i] ^ b[j]].push_back({i, j});
}
for (int i = 1; i <= 100; ++i) {
string s; cin >> s; int bs = 0;
for (char ch : s) bs ^= ch == '1' ? val[i] : 0;
auto [u, v] = mp[bs].front();
cout << u + 1 << " " << v + 1 << "\n";
}
}
void solve() {
cin >> name;
if (name == "Alice" or name == "Bob") cook();
else eat();
}
signed main() {
#ifndef CDuongg
if(fopen(taskname".inp", "r"))
assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
freopen("bai3.inp", "r", stdin);
freopen("bai3.out", "w", stdout);
auto start = chrono::high_resolution_clock::now();
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1; //cin >> t;
while(t--) solve();
#ifdef CDuongg
auto end = chrono::high_resolution_clock::now();
cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
cout << "Check array size pls sir" << endl;
#endif
}
詳細信息
Test #1:
score: 0
Instance #2 Runtime Error
First Run Input
Alice 111101001110010010001100100110111010100101011011100010101101001000010111100100110100000111101101111110010010000110000110111000111101010101011000000011011110000001000101110110101110010011110110110000100101110111000010010101010110011010001101100111001010100011001000100101100101010110000100001110...
First Run Output
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Second Run Input
Second Run Output
Third Run Input
Third Run Output
Manager to Checker
WA Wrong Answer on First Run: the length of the output should be exactly 3000.