QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#508254 | #6189. Full Clue Problem | chimera | AC ✓ | 0ms | 3600kb | C++14 | 1.8kb | 2024-08-07 11:42:59 | 2024-08-07 11:42:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int A[3][2][2] = {{{3,2},{2,3}}, {{1,1},{0,1}}, {{1,0},{1,1}}};
int main() {
int N; cin >> N;
vector<vector<int>> M(N, vector<int>(N));
vector<int> steps;
steps.push_back(1);
for(ll i = 0; i < N-2; i++) steps.push_back(2);
steps.push_back(1);
ll x = 0, y = 0;
while(steps.size()) {
auto b = steps.back(); steps.pop_back();
while(b--) {M[x][y]=1; x++;}
if(steps.size()) {
auto b = steps.back(); steps.pop_back();
while(b--) {M[x][y]=1; y++;}
}
}
M[x][y]=1;
vector<vector<int>> A(N, vector<int>(N, 0));
for(ll i = 0; i < N; i++) {
for(ll j = 0; j < N; j++) {
ll ct = 0;
for(ll di = -1; di < 2; di++) {
for(ll dj = -1; dj < 2; dj++) {
if(!(di || dj)) continue;
if(di && dj) continue;
ll i2 = i+di, j2 = j+dj;
if((i2 < 0) || (i2 >= N) || (j2 < 0 )|| (j2 >= N)) {
if(M[i][j]) ct++;
continue;
}
if((M[i2][j2] != M[i][j])) ct++;
}
}
A[i][j] = ct;
}
}
for(ll i = 0; i < N; i++) {
for(ll j = 0; j < N; j++)
cout << A[i][j] << " ";
cout << "\n";
}
cout << "\n";
for(ll i = 0; i < N; i++) {
for(ll j = 0; j < N; j++)
cout << M[i][j] << " ";
cout << "\n";
}
cout << "\n";
for(ll j = 0; j < N; j++) {
for(ll i = 0; i < N; i++)
cout << M[i][j] << " ";
cout << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
5
output:
3 2 1 0 0 2 2 2 1 0 1 2 2 2 1 0 1 2 2 2 0 0 1 2 3 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
2
output:
3 2 2 3 1 0 1 1 1 1 0 1
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
3
output:
3 2 1 2 2 2 1 2 3 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1
result:
ok ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4
output:
3 2 1 0 2 2 2 1 1 2 2 2 0 1 2 3 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1
result:
ok ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
10
output:
3 2 1 0 0 0 0 0 0 0 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 1 2 2 2 0 0 0 0 0 0 0 1 2 3 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0...
result:
ok ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
19
output:
3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0...
result:
ok ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
20
output:
3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2...
result:
ok ok