QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#397699 | #3750. 全 1 子矩阵 | Graphcity# | AC ✓ | 0ms | 3820kb | C++20 | 677b | 2024-04-24 16:03:38 | 2024-04-24 16:03:39 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int Maxn=10;
int n,m,s[15][15];
inline void Solve()
{
For(i,1,n) For(j,1,m) scanf("%1d",&s[i][j]);
int flg=0; For(i,1,n) For(j,1,m) flg+=s[i][j];
if(!flg) {puts("No"); return;}
int mnx=15,mxx=0,mny=15,mxy=0;
For(i,1,n) For(j,1,m) if(s[i][j])
mnx=min(mnx,i),mxx=max(mxx,i),
mny=min(mny,j),mxy=max(mxy,j);
if((mxx-mnx+1)*(mxy-mny+1)==flg) puts("Yes");
else puts("No");
}
int main()
{
// freopen("1.in","r",stdin);
while(cin>>n>>m) Solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
1 1 0 1 1 1 1 2 00 1 2 10 1 2 01 1 2 11 1 3 000 1 3 100 1 3 010 1 3 110 1 3 001 1 3 101 1 3 011 1 3 111 2 1 0 0 2 1 1 0 2 1 0 1 2 1 1 1 2 2 00 00 2 2 10 00 2 2 01 00 2 2 11 00 2 2 00 10 2 2 10 10 2 2 01 10 2 2 11 10 2 2 00 01 2 2 10 01 2 2 01 01 2 2 11 01 2 2 00 11 2 2 10 11 2 2 01 11 2 2 11 11 2 3 ...
output:
No Yes No Yes Yes Yes No Yes Yes Yes Yes No Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes No No Yes No Yes No Yes No No Yes No Yes Yes Yes Yes No Yes Yes Yes Yes No No No No No No Yes No Yes No No No No No Yes No No Yes No No No No Yes No No No Yes No No No No No No No No No No No Yes No No No No No...
result:
ok 1000 tokens