답안 #1118383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1118383 2024-11-25T12:13:32 Z Younis_Dwai Bomb (IZhO17_bomb) C++14
3 / 100
100 ms 37204 KB
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define pb push_back
//#define int long long
#define in insert
#define mid (l+r)/2
#define in insert
using namespace std;
const int N=2505;
char b[N][N];
int n,m,pref[N][N];
//set<pair<int,int>> adj[N][N];
void init(){
     for(int i=1;i<=n;i++){
         for(int j=1;j<=m;j++){
             pref[i][j]=pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1]+bool(b[i][j]=='1');
         }
     }
     return ;
}
int query(int x , int y , int x1 , int y1){
    return pref[x1][y1]-pref[x1][y-1]-pref[x-1][y1]+pref[x-1][y-1];
}
int32_t main(){
    ios::sync_with_stdio(false);cin.tie(nullptr);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) cin>>b[i][j];
    init();
    if(n==1){
       int mx=m;
       for(int i=1;i<=m;i++){
           if(b[1][i]=='1'){
              int cnt=1;
              while(i+1<=m && b[1][i+1]==b[1][i]){
                    ++i;
                    ++cnt;

              }
              mx=min(mx,cnt);
              ++i;
           }
       }
       cout<<mx;
    }
    /*else if(m==1){
          int mx=n;
          for(int i=1;i<=n;i++){
              if(b[i][1]=='1'){
                 int cnt=1;
                 while(i+1<=n && b[i+1][1]==b[i][1]){
                    ++i;
                    ++cnt;
                 }
                 mx=min(mx,cnt);
                 ++i;
              }
          }
          cout<<mx;
    }
    else{
         int mx=0,all=0;
         for(int i=1;i<=n;i++)
             for(int j=1;j<=m;j++) if(b[i][j]=='1') ++all;
         for(int i=1;i<=n;i++){
             for(int j=1;j<=m;j++){
                 if(b[i][j]=='0') continue ;
                 for(int i1=1;i1<=i;i1++){
                     for(int j1=1;j1<=j;j1++){
                         for(int i2=i;i2<=n;i2++){
                             for(int j2=j;j2<=m;j2++){
                                 if(b[i1][j1]=='1' && b[i2][j2]=='1' && query(i1,j1,i2,j2)==(i2-i1+1)*(j2-j1+1)){
                                    adj[i2-i1+1][j2-j1+1].in({i,j});
                                 }
                             }
                         }
                     }
                 }
             }
         }
         for(int i=1;i<=n;i++){
             for(int j=1;j<=m;j++){
                 if((int)adj[i][j].size()==all) mx=max(mx,i*j);
             }
         }
         cout<<mx;
    }*/
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 476 KB Output isn't correct
3 Incorrect 13 ms 16476 KB Output isn't correct
4 Incorrect 11 ms 16476 KB Output isn't correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 1 ms 604 KB Output isn't correct
9 Incorrect 1 ms 604 KB Output isn't correct
10 Incorrect 1 ms 348 KB Output isn't correct
11 Incorrect 1 ms 604 KB Output isn't correct
12 Incorrect 1 ms 504 KB Output isn't correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Incorrect 1 ms 348 KB Output isn't correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Incorrect 1 ms 604 KB Output isn't correct
17 Incorrect 1 ms 860 KB Output isn't correct
18 Incorrect 1 ms 860 KB Output isn't correct
19 Incorrect 1 ms 1116 KB Output isn't correct
20 Incorrect 2 ms 904 KB Output isn't correct
21 Incorrect 1 ms 760 KB Output isn't correct
22 Incorrect 1 ms 860 KB Output isn't correct
23 Incorrect 2 ms 956 KB Output isn't correct
24 Incorrect 1 ms 860 KB Output isn't correct
25 Incorrect 1 ms 1116 KB Output isn't correct
26 Incorrect 1 ms 1116 KB Output isn't correct
27 Incorrect 4 ms 2692 KB Output isn't correct
28 Incorrect 4 ms 2716 KB Output isn't correct
29 Incorrect 4 ms 3420 KB Output isn't correct
30 Incorrect 6 ms 4188 KB Output isn't correct
31 Incorrect 4 ms 3168 KB Output isn't correct
32 Incorrect 5 ms 3680 KB Output isn't correct
33 Incorrect 5 ms 4188 KB Output isn't correct
34 Incorrect 3 ms 3164 KB Output isn't correct
35 Incorrect 5 ms 4188 KB Output isn't correct
36 Incorrect 6 ms 4188 KB Output isn't correct
37 Incorrect 1 ms 604 KB Output isn't correct
38 Incorrect 72 ms 37132 KB Output isn't correct
39 Incorrect 1 ms 604 KB Output isn't correct
40 Incorrect 17 ms 9724 KB Output isn't correct
41 Incorrect 1 ms 600 KB Output isn't correct
42 Incorrect 1 ms 1104 KB Output isn't correct
43 Incorrect 78 ms 37192 KB Output isn't correct
44 Incorrect 6 ms 4176 KB Output isn't correct
45 Incorrect 71 ms 37052 KB Output isn't correct
46 Incorrect 83 ms 37192 KB Output isn't correct
47 Incorrect 72 ms 37192 KB Output isn't correct
48 Incorrect 70 ms 37192 KB Output isn't correct
49 Incorrect 80 ms 37064 KB Output isn't correct
50 Incorrect 82 ms 37192 KB Output isn't correct
51 Incorrect 86 ms 37184 KB Output isn't correct
52 Incorrect 93 ms 37088 KB Output isn't correct
53 Incorrect 89 ms 37192 KB Output isn't correct
54 Incorrect 89 ms 37068 KB Output isn't correct
55 Incorrect 81 ms 37116 KB Output isn't correct
56 Incorrect 94 ms 37192 KB Output isn't correct
57 Incorrect 80 ms 37160 KB Output isn't correct
58 Incorrect 77 ms 37148 KB Output isn't correct
59 Incorrect 84 ms 37100 KB Output isn't correct
60 Incorrect 79 ms 37192 KB Output isn't correct
61 Incorrect 86 ms 37056 KB Output isn't correct
62 Incorrect 98 ms 37192 KB Output isn't correct
63 Incorrect 94 ms 37044 KB Output isn't correct
64 Incorrect 72 ms 37192 KB Output isn't correct
65 Incorrect 74 ms 37196 KB Output isn't correct
66 Incorrect 92 ms 37196 KB Output isn't correct
67 Incorrect 95 ms 37128 KB Output isn't correct
68 Incorrect 78 ms 37052 KB Output isn't correct
69 Incorrect 76 ms 37068 KB Output isn't correct
70 Incorrect 53 ms 28744 KB Output isn't correct
71 Incorrect 75 ms 37200 KB Output isn't correct
72 Incorrect 99 ms 37136 KB Output isn't correct
73 Incorrect 77 ms 37192 KB Output isn't correct
74 Incorrect 96 ms 37104 KB Output isn't correct
75 Incorrect 100 ms 37192 KB Output isn't correct
76 Incorrect 80 ms 37084 KB Output isn't correct
77 Incorrect 83 ms 37000 KB Output isn't correct
78 Incorrect 76 ms 37192 KB Output isn't correct
79 Incorrect 95 ms 37196 KB Output isn't correct
80 Incorrect 94 ms 37164 KB Output isn't correct
81 Incorrect 74 ms 37132 KB Output isn't correct
82 Incorrect 75 ms 37192 KB Output isn't correct
83 Incorrect 79 ms 37192 KB Output isn't correct
84 Incorrect 78 ms 37192 KB Output isn't correct
85 Incorrect 89 ms 37192 KB Output isn't correct
86 Incorrect 82 ms 37144 KB Output isn't correct
87 Incorrect 79 ms 37192 KB Output isn't correct
88 Incorrect 85 ms 37192 KB Output isn't correct
89 Incorrect 79 ms 37100 KB Output isn't correct
90 Incorrect 55 ms 28740 KB Output isn't correct
91 Incorrect 77 ms 37204 KB Output isn't correct
92 Incorrect 87 ms 37204 KB Output isn't correct
93 Incorrect 82 ms 37196 KB Output isn't correct
94 Incorrect 80 ms 37128 KB Output isn't correct
95 Incorrect 91 ms 37192 KB Output isn't correct
96 Incorrect 97 ms 37120 KB Output isn't correct
97 Incorrect 96 ms 36984 KB Output isn't correct
98 Incorrect 75 ms 37192 KB Output isn't correct
99 Incorrect 79 ms 37192 KB Output isn't correct
100 Incorrect 76 ms 37192 KB Output isn't correct