QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#351956 | #6418. Ah, It's Yesterday Once More | PorNPtree# | AC ✓ | 0ms | 3616kb | C++14 | 2.0kb | 2024-03-12 17:39:34 | 2024-03-12 17:39:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n, m, a[25][25];
signed main()
{
// stack<string> S;
// string s;
// while (cin >> s) {
// if (s == "END") {
// break;
// }
// S.push(s);
// }
// while (!S.empty()) {
// puts(S.top().c_str());
// S.pop();
// }
puts(R"(20 20
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000000000000000000
11111111111111111111
00000000000000000001
11111111111111111111
10000100010001000100
10111011101110111011
11101110111011101110)");
return 0;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i) {
string s;
cin >> s;
for (int j = 1; j <= m; ++j) {
a[i][j] = (s[j - 1] == '1');
}
}
int cnt = 0;
srand(time(0));
for (int T = 0; T < 500; ++T) {
set< pair<int, int> > S, tS;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
if (a[i][j]) {
S.insert(make_pair(i, j));
}
}
}
for (int i = 0; i < 50000 && S.size() > 1; ++i) {
int t = rand() % 4;
int ty = (t <= 1 ? 0 : (t == 2 ? -1 : 1));
int tx = (t >= 2 ? 0 : (t == 0 ? -1 : 1));
tS.clear();
for (auto [x, y] : S) {
int zx = x + tx, zy = y + ty;
if (zx >= 1 && zx <= n && zy >= 1 && zy <= n && a[zx][zy]) {
tS.insert({zx, zy});
} else {
tS.insert({x, y});
}
}
S = tS;
}
printf("%d\n", (int)S.size());
cnt += (int)S.size() != 1;
}
printf("%.2lf%%\n", (double)cnt / 5);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
output:
20 20 11111111111111111111 10000000000000000000 11111111111111111111 00000000000000000001 11111111111111111111 10000000000000000000 11111111111111111111 00000000000000000001 11111111111111111111 10000000000000000000 11111111111111111111 00000000000000000001 11111111111111111111 10000000000000000000 ...
result:
ok 125 successful hack.