QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#466012 | #8813. Records in Chichén Itzá | HKOI0# | WA | 0ms | 3528kb | C++17 | 2.8kb | 2024-07-07 14:48:02 | 2024-07-07 14:48:03 |
Judging History
answer
#include <bits/stdc++.h>
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
struct HPA {
vector<int> a;
HPA(int x=0) {
for(;x;x/=10) a.emplace_back(x%10);
}
HPA& operator+=(const HPA& other) {
a.emplace_back(0);
for(int i=0;i<sz(a);i++) {
if(i<sz(other.a)) a[i]+=other.a[i];
a[i+1]+=a[i]/10;
a[i]%=10;
}
if(sz(a)>1&&a[sz(a)-1]==0) a.pop_back();
return *this;
}
bool operator<(const HPA& other) {
if(sz(a)!=sz(other.a)) return sz(a)<sz(other.a);
vector<int> x(a);
vector<int> y(other.a);
reverse(all(x));
reverse(all(y));
return x<y;
}
};
struct Cell {
array<array<char, 2>, 2> a;
array<int, 3> rowof;
array<int, 3> colof;
inline array<char, 2>& operator [] (int x) {
return a[x];
}
Cell() {
for (int i = 0; i < 3; i++)
rowof[i] = colof[i] = -1;
}
};
enum Position {
undef, L, R
};
void solve() {
int n; cin >> n;
vector<Cell> cells(n);
{
vector<string> grid(2);
cin >> grid[0] >> grid[1];
cout << grid[0] << '\n' << grid[1] << '\n';
for (int i = 0; i < n; i++) {
for (int row = 0; row <= 1; row++) {
for (int col = 0; col <= 1; col++) {
cells[i][row][col] = grid[row][i * 2 + col];
}
}
}
};
for (int i = 0; i < 2 * n; i++)
cout << cells[i / 2][0][i % 2];
cout << "\n";
for (int i = 0; i < 2 * n; i++)
cout << cells[i / 2][1][i % 2];
cout << "\n";
for (int i = 0; i < n; i++) {
Position pos1 = undef, pos2 = undef;
for (int row = 0; row <= 1; row++) {
for (int col = 0; col <= 1; col++) {
for (int num = 1; num <= 2; num++) {
if (cells[i][row][col] == num) {
cells[i].rowof[num] = row;
cells[i].colof[num] = col;
}
}
}
}
}
// index of the first RIGHT cell
vector<int> minPart(2, 0);
vector<int> maxPart(2, n - 1);
for (int i = 0; i < n; i++) {
for (int num = 1; num <= 2; num++) {
if (cells[i].colof[num] == 0)
minPart[num] = max(minPart[num], i + 1);
if (cells[i].colof[num] == 1)
maxPart[num] = min(maxPart[num], i);
}
}
}
signed main() {
#ifndef LOCAL
ios::sync_with_stdio(false);
cin.tie(nullptr);
#endif
int T = 1;
cin >> T;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3528kb
input:
3 6 1 1 1 1 3 3 5 1 1 2 2 2 10 1 1 1 1 2 2 2 2 3 3
output:
1 1 1
result:
wrong answer 1st words differ - expected: 'No', found: '1'