QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#397714#3750. 全 1 子矩阵xlwang#WA 0ms3904kbC++141.7kb2024-04-24 16:10:422024-04-24 16:10:43

Judging History

你现在查看的是最新测评结果

  • [2024-04-24 16:10:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3904kb
  • [2024-04-24 16:10:42]
  • 提交

answer

#include<bits/stdc++.h>
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
using namespace std;
inline int read(){
	int x=0;
	bool f=0;
	char c=getchar();
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
inline void write(int x){
    if(x<0){putchar('-');x=-x;}
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
//	int t=read();
//	while(t--) work();
//}
int n,m;
char c[20][20];
inline bool check(int l,int r,int ln1,int ln2){
    // cout<<l<<' '<<r<<' '<<ln1<<' '<<ln2<<endl;
    if(l+ln1-1>n) return false;
    if(r+ln2-1>m) return false;
    fr(i,l,l+ln1-1) fr(j,r,r+ln2-1) if(c[i][j]=='0') return false;
    return true;
}
inline void work(){
    fr(i,1,n) scanf("%s",c[i]+1);
    int num=0;
    fr(i,1,n) fr(j,1,m) num+=(c[i][j]=='1');
    // cout<<num<<endl;
    fr(i,1,n) fr(j,1,m) fr(x,1,n-i+1){
        if(num%x!=0) continue;
        if(check(i,j,x,num/x)){
            puts("Yes");
            return;
        }
    }
    puts("No");
}
inline void init(){
    while(cin>>n>>m) work();
}
signed main(){
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
    init();
    // printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3904kb

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:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
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...

result:

wrong answer 1st words differ - expected: 'No', found: 'Yes'