Submission #472303

# Submission time Handle Problem Language Result Execution time Memory
472303 2021-09-13T11:22:42 Z HossamHero7 Strah (COCI18_strah) C++14
22 / 110
1000 ms 43252 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
int n,m;
bool valid(int i,int j){
    if(i<n && i >=0 && j<m && j >=0) return 1;
    return 0;
}
void solve(){
    cin>>n>>m;
    vector <string> v(n);
    vector <vector<ll>> ans(n,vector<ll>(m));
    for(auto &i:v) cin>>i;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            for(int k=0;k<n;k++){
                for(int c=0;c<m;c++){
                    if(valid(i+k,j+c)){
                        bool x = 1;
                        for(int z=i;z<=i+k;z++){
                            for(int f=j;f<=j+c;f++){
                                if(v[z][f] == '#') x = 0;
                            }
                        }
                        if(x){
                            for(int z=i;z<=i+k;z++){
                                for(int f=j;f<=j+c;f++){
                                    ans[z][f] ++;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    ll x = 0;
    for(auto i : ans){
        for(auto j : i) x += j;
    }
    cout<<x<<endl;
}
int main()
{
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 1228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 1200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 1228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 11084 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 24516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 15544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 3148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 43252 KB Time limit exceeded
2 Halted 0 ms 0 KB -