QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#358064 | #6189. Full Clue Problem | schrodingerstom | AC ✓ | 1ms | 3904kb | C++14 | 1.9kb | 2024-03-19 16:55:14 | 2024-03-19 16:55:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
bool memBeg;
template<typename T> void chkmin(T &x,T y) {if(x>y) x=y;}
template<typename T> void chkmax(T &x,T y) {if(x<y) x=y;}
constexpr int mod=1e9+7;
void inc(int &x,int y) {x+=y; x-=(x>=mod)*mod;}
void dec(int &x,int y) {x-=y; x+=(x<0)*mod;}
constexpr int add(int x,int y) {return (x+y>=mod)?x+y-mod:x+y;}
constexpr int sub(int x,int y) {return (x<y)?x-y+mod:x-y;}
constexpr int quick_pow(int x,int times) {
int ret=1;
for(;times;times>>=1,x=1ll*x*x%mod) {
if(times&1) ret=1ll*ret*x%mod;
}
return ret;
}
constexpr int maxn=25;
int n,mat1[maxn][maxn],mat2[maxn][maxn],occ1[maxn][maxn],occ2[maxn][maxn];
void gocc(int mat[maxn][maxn],int occ[maxn][maxn]) {
for(int i=0;i<=n;i++) {
for(int j=0;j<=n;j++) {
if(mat[i][j]!=mat[i+1][j]) {
occ[i][j]++; occ[i+1][j]++;
}
if(mat[i][j]!=mat[i][j+1]) {
occ[i][j]++; occ[i][j+1]++;
}
}
}
}
void print(int mat[maxn][maxn]) {
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) printf("%d ",mat[i][j]);
puts("");
}
}
bool memEn;
void fl() {
freopen(".in","r",stdin);
freopen(".out","w",stdout);
}
int main() {
fprintf(stderr,"%.24lf\n",fabs(&memEn-&memBeg)/1024.0/1024.0);
// fl();
scanf("%d",&n);
for(int i=1;i<=n;i++) {
mat1[i][i]=mat2[i][i]=1;
if(i<n) {
if(i&1) mat1[i][i+1]=mat2[i+1][i]=1;
else mat1[i+1][i]=mat2[i][i+1]=1;
}
}
gocc(mat1,occ1); gocc(mat2,occ2);
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) assert(occ1[i][j]==occ2[i][j]);
}
print(occ1); puts("");
print(mat1); puts("");
print(mat2);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3880kb
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 1 0 0 0 0 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
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
2
output:
3 2 2 3 1 1 0 1 1 0 1 1
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
3
output:
3 2 1 2 2 2 1 2 3 1 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1
result:
ok ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
4
output:
3 2 1 0 2 2 2 1 1 2 2 2 0 1 2 3 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1
result:
ok ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3900kb
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 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 0 1 0 0 0 0 0 0 0 0 0...
result:
ok ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3900kb
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: 1ms
memory: 3864kb
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